One Logo Pool Ball
CryptoKit · IOS API REFERENCE

MLKEM768.PrivateKey

struct · iOS 26.0+ · SDK 27.1

struct PrivateKey

A private key you use to decapsulate shared secrets with the Module-Lattice key encapsulation mechanism.

Members (8)

get · iOS 26.0+

publicKey

TypeScript
get publicKey(): MLKEM768_PublicKey
Swift declaration
var publicKey: MLKEM768.PublicKey { get }

The corresponding public key.

method · iOS 26.0+

decapsulate

TypeScript
decapsulate(encapsulated: ArrayBuffer): SymmetricKey
Swift declaration
func decapsulate<D>(_ encapsulated: D) throws -> SymmetricKey where D : DataProtocol

Decapsulate a shared secret. - Parameters: - encapsulated: An encapsulated shared secret, that you get by calling ``MLKEM768/PublicKey/encapsulate()`` on the corresponding public key. - Returns: The shared secret.

init · iOS 26.0+

init

TypeScript
static initSeedRepresentationPublicKey(seedRepresentation: ArrayBuffer, publicKey?: (MLKEM768_PublicKey) | null): MLKEM768_PrivateKey
Swift declaration
init<D>(seedRepresentation: D, publicKey: MLKEM768.PublicKey?) throws where D : DataProtocol

Initializes a private key from a seed representation and optional public key. - Parameters: - seedRepresentation: The seed representation `d||z`, as specified in the `ML-KEM.KeyGen_internal(d,z)` algorithm (Algorithm 16) of FIPS 203. - publicKey: An optional public key. Pass this to check that the initialized private key is consistent with the public key. The initializer throws if the public key doesn't match the expected value.

get · iOS 26.0+

seedRepresentation

TypeScript
get seedRepresentation(): ArrayBuffer
Swift declaration
var seedRepresentation: Data { get }

The private key's seed representation. The seed is `d||z`, as specified in the algorithm `ML-KEM.KeyGen_internal(d,z)` (Algorithm 16) of FIPS 203.

get · iOS 26.0+

integrityCheckedRepresentation

TypeScript
get integrityCheckedRepresentation(): ArrayBuffer
Swift declaration
var integrityCheckedRepresentation: Data { get }

An integrity-checked representation of the private key. This representation includes the seed value, and a hash of the corresponding public key.

init · iOS 26.0+

init

TypeScript
static initIntegrityCheckedRepresentation(integrityCheckedRepresentation: ArrayBuffer): MLKEM768_PrivateKey
Swift declaration
init<D>(integrityCheckedRepresentation: D) throws where D : DataProtocol

Initializes a private key from an integrity-checked representation. - Parameter integrityCheckedRepresentation: A representation of the private key that includes the seed value, and a hash of the corresponding public key.

static · iOS 26.0+

generate

TypeScript
static generate(): MLKEM768_PrivateKey
Swift declaration
static func generate() throws -> MLKEM768.PrivateKey

Generates a new, random private key.

init · iOS 26.0+

init

TypeScript
static init(): MLKEM768_PrivateKey
Swift declaration
init() throws

Initializes a random private key.

Skipped declarations

No declarations were skipped in this snapshot.

All CryptoKit types →