ECPrimeRandomKey

public struct ECPrimeRandomKey

ECPrimeRandomKey is a representation of Elliptic Curve Key on iOS’ Secure Enclave to generate hardware-backed security key and to perform encryption, decryption, and signing operations using the key.

Public instance methods

  • Extracts public key data and converts it into DER format

    Throws

    SecurityError

    Declaration

    Swift

    public func getPublicKeyDERData() throws -> Data

    Return Value

    Bytes array of public key representation in DER format

  • Signs given bytes array using EC Prime Random Key using SHA256

    Declaration

    Swift

    public func sign(data: Data) -> Data?

    Parameters

    data

    Data object to be signed

    Return Value

    Signed data

Static Keypair generation / store method

  • Generates or retrieves EC Prime Random key with given information

    Declaration

    Swift

    public static func getKeypair(label: String, accessGroup: String? = nil, context: LAContext? = nil) -> ECPrimeRandomKey?

    Parameters

    label

    Label string value to generate or retrieve ECPrimeRandomKey object

    accessGroup

    Optional Access Group string to be shared using Shared Keychain Service

    context

    Optional LAContext to be used to retrieve the key

    Return Value

    ECPrimeRandomKey object