One Logo Pool Ball
CryptoKit · IOS API REFERENCE

P384.KeyAgreement.PrivateKey

struct · iOS 13.0+ · SDK 27.1

struct PrivateKey

A P-384 private key used for key agreement.

Members (12)

method · iOS 13.0+

sharedSecretFromKeyAgreement

TypeScript
sharedSecretFromKeyAgreement(publicKeyShare: P384_KeyAgreement_PublicKey): SharedSecret
Swift declaration
func sharedSecretFromKeyAgreement(with publicKeyShare: P384.KeyAgreement.PublicKey) throws -> SharedSecret

Computes a shared secret with the provided public key from another party. - Parameters: - publicKeyShare: The public key from another party to be combined with the private key from this user to create the shared secret. - Returns: The computed shared secret.

get · iOS 13.0+

publicKey

TypeScript
get publicKey(): P384_KeyAgreement_PublicKey
Swift declaration
var publicKey: P384.KeyAgreement.PublicKey { get }

The corresponding public key.

get · iOS 14.0+

derRepresentation

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

A Distinguished Encoding Rules (DER) encoded representation of the private key.

init · iOS 14.0+

init

TypeScript
static initDerRepresentation(derRepresentation: Array<number>): P384_KeyAgreement_PrivateKey
Swift declaration
init<Bytes>(derRepresentation: Bytes) throws where Bytes : RandomAccessCollection, Bytes.Element == UInt8

Creates a P-384 private key for key agreement from a Distinguished Encoding Rules (DER) encoded representation. - Parameters: - derRepresentation: A DER-encoded representation of the key.

init · iOS 14.0+

init

TypeScript
static initPemRepresentation(pemRepresentation: string): P384_KeyAgreement_PrivateKey
Swift declaration
init(pemRepresentation: String) throws

Creates a P-384 private key for key agreement from a Privacy-Enhanced Mail PEM) representation. - Parameters: - pemRepresentation: A PEM representation of the key.

get · iOS 14.0+

pemRepresentation

TypeScript
get pemRepresentation(): string
Swift declaration
var pemRepresentation: String { get }

A Privacy-Enhanced Mail (PEM) representation of the private key.

get · iOS 13.0+

rawRepresentation

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

A data representation of the private key.

init · iOS 13.0+

init

TypeScript
static initRawRepresentation(rawRepresentation: ArrayBuffer): P384_KeyAgreement_PrivateKey
Swift declaration
init<Bytes>(rawRepresentation: Bytes) throws where Bytes : ContiguousBytes

Creates a P-384 private key for key agreement from a collection of bytes. - Parameters: - rawRepresentation: A raw representation of the key as a collection of contiguous bytes.

get · iOS 13.0+

x963Representation

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

An ANSI x9.63 representation of the private key.

init · iOS 13.0+

init

TypeScript
static initX963Representation(x963Representation: ArrayBuffer): P384_KeyAgreement_PrivateKey
Swift declaration
init<Bytes>(x963Representation: Bytes) throws where Bytes : ContiguousBytes

Creates a P-384 private key for key agreement from an ANSI x9.63 representation. - Parameters: - x963Representation: An ANSI x9.63 representation of the key.

init · iOS 13.0+

init

TypeScript
static initCompactRepresentable(compactRepresentable?: boolean): P384_KeyAgreement_PrivateKey
Swift declaration
init(compactRepresentable: Bool = true)

Creates a random P-384 private key for key agreement. Keys that use a compact point encoding enable shorter public keys, but aren’t compliant with FIPS certification. If your app requires FIPS certification, create a key with ``init(rawRepresentation:)``. - Parameters: - compactRepresentable: A Boolean value that indicates whether CryptoKit creates the key with the structure to enable compact point encoding.

init · iOS 17.0+

init

TypeScript
static init(): P384_KeyAgreement_PrivateKey
Swift declaration
init()

Creates a NIST P-384 elliptic curve private key for use with Diffie-Hellman key exchange.

Skipped declarations

No declarations were skipped in this snapshot.

All CryptoKit types →