gpt4 book ai didi

ios - 即使应用程序卸载后,Secure Enclave key 仍然存在

转载 作者:行者123 更新时间:2023-11-28 23:53:15 24 4
gpt4 key购买 nike

我已经使用以下代码片段在 Secure enclave 内生成了 key ,

func generateKeyPair(accessControl: SecAccessControl) throws -> (`public`: SecureEnclaveKeyReference, `private`: SecureEnclaveKeyReference) {

let privateKeyParams: [String: Any] = [
kSecAttrLabel as String: privateLabel,
kSecAttrIsPermanent as String: true,
kSecAttrAccessControl as String: accessControl,
]
let params: [String: Any] =
[
kSecAttrKeyType as String: attrKeyTypeEllipticCurve,
kSecAttrKeySizeInBits as String: 256,
kSecAttrTokenID as String: kSecAttrTokenIDSecureEnclave,
kSecPrivateKeyAttrs as String: privateKeyParams
]
var publicKey, privateKey: SecKey?

let status = SecKeyGeneratePair(params as CFDictionary, &publicKey, &privateKey)

guard status == errSecSuccess else {

throw SecureEnclaveHelperError(message: "Could not generate keypair", osStatus: status)
}

return (public: SecureEnclaveKeyReference(publicKey!), private: SecureEnclaveKeyReference(privateKey!))
}

应用程序卸载后 key 仍然存在,有没有办法从安全区域中删除 key ?

提前谢谢你:)

最佳答案

There is no trigger to perform code when the app is deleted from the device. Access to the keychain is dependant on the provisioning profile that is used to sign the application. Therefore no other applications would be able to access this information in the keychain.

https://stackoverflow.com/a/5711090/7350472

如果你想从 Secure Enclave 中删除 key ,你可以调用:

SecItemDelete(query as CFDictionary)

https://developer.apple.com/documentation/security/1395547-secitemdelete

关于ios - 即使应用程序卸载后,Secure Enclave key 仍然存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51685476/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com