SecuredKey

public struct SecuredKey : @unchecked Sendable

SecuredKey is a representation of Secure Enclave keypair and performing PKI using Secure Enclave

  • Validates whether SecuredKey using Secure Enclave is available on the device or not

    Declaration

    Swift

    public static func isAvailable() -> Bool
  • Initializes SecuredKey object with designated service; SecuredKey may return nil if it failed to generate keypair

    Declaration

    Swift

    public init?(applicationTag: String)

    Parameters

    applicationTag

    Unique identifier for SecuredKey

  • Encrypts Data object using SecuredKey object

    Declaration

    Swift

    public func encrypt(data: Data, secAlgorithm: SecKeyAlgorithm = .eciesEncryptionCofactorVariableIVX963SHA256AESGCM) -> Data?

    Parameters

    data

    Encrypted Data object

    secAlgorithm

    Algorithm to be used for encryption. Default: .eciesEncryptionCofactorVariableIVX963SHA256AESGCM

    Return Value

    Encrypted Data object or nil if encryption fails

  • Decrypts Data object using SecuredKey object

    Declaration

    Swift

    public func decrypt(data: Data, secAlgorithm: SecKeyAlgorithm = .eciesEncryptionCofactorVariableIVX963SHA256AESGCM) -> Data?

    Parameters

    data

    Decrypted Data object

    secAlgorithm

    Algorithm to be used for decryption. Default: .eciesEncryptionCofactorVariableIVX963SHA256AESGCM

    Return Value

    Decrypted Data object or nil if decryption fails