在 iOS 上使用 Apples libcommonCrypto.dylib
时,kSecAttrIsPermanent
属性有什么用?
The corresponding value is of type CFBooleanRef and indicates whether this cryptographic key is to be stored permanently.
不将某些东西永久存储在钥匙串(keychain)中的原因是什么?那么它会存储多长时间? (直到重启?直到应用关闭?直到应用被卸载?)
最佳答案
这是生成 key 时在 SecKeyGeneratePair
中使用的参数。
来自Certificate, Key, and Trust Services Reference
kSecAttrIsPermanent
— If this key is present and has a Boolean value of true, the key or key pair is added to the default keychain.
在此上下文中,如果您提供此参数并且它为 false,那么您将在内存中收到 key ,但不会持久保存到钥匙串(keychain)(在磁盘上)。无论您在应用程序仍在运行时保留它多久,它都会持续,除非您之后自己坚持它。
关于ios - 如果将 kSecAttrIsPermanent 设置为 NO 会发生什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21604225/