ios - 如果将 kSecAttrIsPermanent 设置为 NO 会发生什么?

标签 ios objective-c commoncrypto

在 iOS 上使用 Apples libcommonCrypto.dylib 时,kSecAttrIsPermanent 属性有什么用?

Apples documentation说:

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/

相关文章:

ios - NSPredicate 与 NSNumbers 的 NSArray(核心数据)

ios - 从计划中的数组中删除适当的 CCSprite

ios - 类 'NSManagedObject' 的 NSManagedObject 必须具有有效的 NSEntityDescription

ios - CC_MD5() 和 CC_SHA1() 在 iOS 4 中可用吗?

ios - Swift 计算大文件的 MD5 校验和

swift - CommonCrypto 如何在 SWIFT3 中使用?

ios - "com.apple.OMC"是什么 iOS 功能/权利?

ios - tableView 单元格内的多个 collectionView 单元格在滚动时更改设计

ios - MVC 设计模式 - 设计模型

ios - 如何在后台模式下获取当前位置并在后台模式下继续将该位置发送到服务器