One Logo Pool Ball
CryptoKit · IOS API REFERENCE

SecureEnclave.P256.Signing.PrivateKey

struct · iOS 13.0+ · SDK 27.1

struct PrivateKey

A P-256 private key used for signing.

Members (5)

get · iOS 13.0+

publicKey

TypeScript
get publicKey(): P256_Signing_PublicKey
Swift declaration
let publicKey: P256.Signing.PublicKey

The corresponding public key.

get · iOS 13.0+

dataRepresentation

TypeScript
get dataRepresentation(): ArrayBuffer
Swift declaration
let dataRepresentation: Data

A data representation of the private key.

init · iOS 13.0+

init

TypeScript
static initDataRepresentationAuthenticationContext(dataRepresentation: ArrayBuffer, authenticationContext?: (_LocalAuthentication_LAContext) | null): SecureEnclave_P256_Signing_PrivateKey
Swift declaration
init(dataRepresentation: Data, authenticationContext: LAContext? = nil) throws

Creates a P-256 private key for signing from a data representation of the key with the given authentication context. - Parameters: - dataRepresentation: A data representation of the key. - authenticationContext: A local authentication context.

init · iOS 13.0+

init

TypeScript
static initCompactRepresentableAccessControlAuthenticationContext(compactRepresentable?: boolean, accessControl?: _Security_SecAccessControl, authenticationContext?: (_LocalAuthentication_LAContext) | null): SecureEnclave_P256_Signing_PrivateKey
Swift declaration
init(compactRepresentable: Bool = true, accessControl: SecAccessControl = SecAccessControlCreateWithFlags(nil, kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly, [], nil)!, authenticationContext: LAContext? = nil) throws

Creates a P-256 private key for signing with the specified access control. - Parameters: - compactRepresentable: A Boolean value that indicates whether CryptoKit creates the key with the structure to enable compact point encoding. - accessControl: The protection type and flags to use when creating the associated access control object. - authenticationContext: A local authentication context.

method · iOS 13.0+

signature

TypeScript
signature(data: ArrayBuffer): P256_Signing_ECDSASignature
Swift declaration
func signature<D>(for data: D) throws -> P256.Signing.ECDSASignature where D : DataProtocol

Generates an elliptic curve digital signature algorithm (ECDSA) signature of the given data over the P-256 elliptic curve, using SHA-256 as the hash function. - Parameters: - data: The data to sign. - Returns: A cryptographic signature. The signing algorithm employs randomization to generate a different signature on every call, even for the same data and key.

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

SecureEnclave.P256.Signing.PrivateKey.signature(for:)

This declaration needs Swift generic type arguments. (no canonical witness for D)

All CryptoKit types →