SecuredKey

public struct SecuredKey

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, accessGroup: String? = nil, accessibility: KeychainAccessibility = .afterFirstUnlock)

    Parameters

    applicationTag

    Unique identifier for SecuredKey in Keychain Service

  • Encrypts Data object using SecuredKey object

    Declaration

    Swift

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

    Parameters

    data

    Encrypted Data object

  • Decrypts Data object using SecuredKey object

    Declaration

    Swift

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

    Parameters

    data

    Decrypted Data object