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
SecuredKeyobject with designated service;SecuredKeymay returnnilif it failed to generate keypairDeclaration
Swift
public init?(applicationTag: String)Parameters
applicationTagUnique identifier for SecuredKey
-
Encrypts Data object using
SecuredKeyobjectDeclaration
Swift
public func encrypt(data: Data, secAlgorithm: SecKeyAlgorithm = .eciesEncryptionCofactorVariableIVX963SHA256AESGCM) -> Data?Parameters
dataEncrypted Data object
secAlgorithmAlgorithm to be used for encryption. Default:
.eciesEncryptionCofactorVariableIVX963SHA256AESGCMReturn Value
Encrypted Data object or
nilif encryption fails -
Decrypts Data object using SecuredKey object
Declaration
Swift
public func decrypt(data: Data, secAlgorithm: SecKeyAlgorithm = .eciesEncryptionCofactorVariableIVX963SHA256AESGCM) -> Data?Parameters
dataDecrypted Data object
secAlgorithmAlgorithm to be used for decryption. Default:
.eciesEncryptionCofactorVariableIVX963SHA256AESGCMReturn Value
Decrypted Data object or
nilif decryption fails