微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

在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.

是什么原因不能永久存储钥匙串中的东西以及存储多长时间? (直到重启?直到应用程序关闭?直到应用程序被卸载?)

解决方法

它是生成密钥时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,那么您将在内存中接收密钥,但它不会持久保存到密钥链(磁盘上).在应用程序仍在运行时,它会持续很长时间,除非你自己坚持下去.

原文地址:https://www.jb51.cc/iOS/327823.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐