SecureCommunications Documentation Beta

Structure Key​Store

public struct KeyStore

Tools to create CryptoKit keys in device secure enclave Requires Secure Enclave on device: iPhone 5s (or later), iPad Air (or later), Mac computers that contain the T1 chip or the Apple T2 Security Chip, Apple TV 4th generation (or later), Apple Watch Series 1 (or later), HomePod Minimum requirements: iOS 13.0, OSX 10.15, watchOS 6.0 or tvOS 13.0 Requires Swift 5.3

Methods

public​Key(x963Representation:​)

public static func publicKey(x963Representation: Data) throws -> P256.KeyAgreement.PublicKey

Returns a P256.KeyAgreement.PublicKey instance of an ANSI x9.63 representation of the public key.

Parameters

x963Representation Data

ANSI x9.63 representation of the public key.

Throws

An error during the public key process

Returns

P256.KeyAgreement.PublicKey instance of the public key.

public​Key(raw​Representation:​)

public static func publicKey(rawRepresentation: Data) throws -> P256.KeyAgreement.PublicKey

Returns a P256.KeyAgreement.PublicKey instance of raw representation of the public key.

Parameters

raw​Representation Data

raw representation of the public key.

Throws

An error during the public key process

Returns

P256.KeyAgreement.PublicKey instance of the public key.

public​Key(pem​Representation:​)

@available(iOS 14.0, macOS 11.0, watchOS 7.0, tvOS 14.0, *) public static func publicKey(pemRepresentation: String) throws -> P256.KeyAgreement.PublicKey

Returns a P256.KeyAgreement.PublicKey instance of the public key of a pem representation

Parameters

pem​Representation String

pem representation of the public key.

Throws

An error during the public key process

Returns

P256.KeyAgreement.PublicKey instance of the public key.

public​Key(der​Representation:​)

@available(iOS 14.0, macOS 11.0, watchOS 7.0, tvOS 14.0, *) public static func publicKey(derRepresentation: Data) throws -> P256.KeyAgreement.PublicKey

Returns a P256.KeyAgreement.PublicKey instance of der representation of the public key.

Parameters

der​Representation Data

der representation of the public key.

Throws

An error during the public key process

Returns

P256.KeyAgreement.PublicKey instance of the public key.

public​Key()

public func publicKey() throws -> P256.KeyAgreement.PublicKey

Returns the Public CryptoKit key generated by KeyStore

Throws

KeychainError or CryptoKitError errors

Returns

P256.KeyAgreement.PublicKey instance of the public key.

public​Key​InX963Representation()

public func publicKeyInX963Representation() throws -> Data

Returns the Public CryptoKit key generated by KeyStore

Throws

KeychainError or CryptoKitError errors

Returns

Data with ANSI x9.63 representation of the public key.

public​Key​InRaw​Representation()

public func publicKeyInRawRepresentation() throws -> Data

Returns the Public CryptoKit key generated by KeyStore

Throws

KeychainError or CryptoKitError errors

Returns

Data with RAW representation of the public key.

public​Key​InPem​Representation()

@available(iOS 14.0, macOS 11.0, watchOS 7.0, tvOS 14.0, *) public func publicKeyInPemRepresentation() throws -> String

Returns the Public CryptoKit key generated by KeyStore

Throws

KeychainError or CryptoKitError errors

Returns

Data with PEM representation of the public key.

public​Key​InDer​Representation()

@available(iOS 14.0, macOS 11.0, watchOS 7.0, tvOS 14.0, *) public func publicKeyInDerRepresentation() throws -> Data

Returns the Public CryptoKit key generated by KeyStore

Throws

KeychainError or CryptoKitError errors

Returns

Data with DER representation of the public key.