MlKemPrivateKey

class MlKemPrivateKey(val algorithm: Algorithm, encoded: ByteArray, val publicKey: MlKemPublicKey) : PrivateKey

An ML-KEM (FIPS 203) private key.

Parameters

encoded

the encoded private key bytes (either seed-only or expanded key).

publicKey

the corresponding public key.

Constructors

Link copied to clipboard
constructor(algorithm: Algorithm, encoded: ByteArray, publicKey: MlKemPublicKey)
constructor(algorithm: Algorithm, encoded: ByteString, publicKey: MlKemPublicKey)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
val encoded: ByteString
Link copied to clipboard
open override val isDestroyed: Boolean

true if this key has been closed/destroyed, false otherwise.

Link copied to clipboard
open override val publicKey: MlKemPublicKey

Functions

Link copied to clipboard
open override fun close()

Securely zeroes out the private key material in memory and marks this key as destroyed. Subsequent cryptographic operations or property accesses on this instance will throw IllegalStateException.

Link copied to clipboard
fun destroy()

Cryptographic alias for close.

Link copied to clipboard
open override fun duplicate(): MlKemPrivateKey

Creates an independent duplicate of this private key with its own lifecycle and memory buffer. The returned key must be closed independently.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toCoseKey(additionalLabels: Map<CoseLabel, DataItem>): CoseKey

Creates a CoseKey object for the key.

Link copied to clipboard

Serializes this private key as a CBOR DataItem encoding a COSE_Key.

Link copied to clipboard
Link copied to clipboard
open override fun toJwk(additionalClaims: JsonObject?): JsonObject

Encodes the private key as a JSON Web Key according to RFC 7517.

Link copied to clipboard
open override fun toPem(): String

Encode this key in PEM format.

Link copied to clipboard

Encodes this private key as a DER-encoded PKCS#8 OneAsymmetricKey sequence.

Link copied to clipboard

Encodes this private key as a DER-encoded PKCS#8 OneAsymmetricKey (PrivateKeyInfo) sequence.

Link copied to clipboard
open override fun toString(): String