Structure
KeyStore
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
publicKey(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
Name | Type | Description |
---|---|---|
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.
publicKey(rawRepresentation:)
public static func publicKey(rawRepresentation: Data) throws -> P256.KeyAgreement.PublicKey
Returns a P256.KeyAgreement.PublicKey
instance of raw representation of the public key.
Parameters
Name | Type | Description |
---|---|---|
rawRepresentation | Data |
raw representation of the public key. |
Throws
An error during the public key process
Returns
P256.KeyAgreement.PublicKey
instance of the public key.
publicKey(pemRepresentation:)
@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
Name | Type | Description |
---|---|---|
pemRepresentation | String |
pem representation of the public key. |
Throws
An error during the public key process
Returns
P256.KeyAgreement.PublicKey
instance of the public key.
publicKey(derRepresentation:)
@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
Name | Type | Description |
---|---|---|
derRepresentation | Data |
der representation of the public key. |
Throws
An error during the public key process
Returns
P256.KeyAgreement.PublicKey
instance of the public key.
publicKey()
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.
publicKeyInX963Representation()
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.
publicKeyInRawRepresentation()
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.
publicKeyInPemRepresentation()
@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.
publicKeyInDerRepresentation()
@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.