开发者

What does kSecReturnPersistentRef do?

Does it make a key chain item persistent be开发者_运维技巧tween application runs?


@Plumenator You can search for a Keychain item later and in the search dictionary provide the value kCFBooleanTrue for the key kSecReturnPersistentRef. If an item is found, Keychain Services return a persistent reference to it. If SecItemAdd() successfully adds an item to the Keychain it will remain there as long as the Keychain exists (usually until a reset of the device) or SecItemDelete() deletes it.

To answer your second question: the key kSecReturnPersistentRef is called a return type key because you specify what the function SecItemAdd() or SecItemCopyMatching() should return to you. Possible flags are kSecReturnPersistentRef, kSecReturnData, kSecReturnAttributes, and kSecReturnRef.


Yes, that's right. Check out Keychain Services Reference:

To obtain a persistent reference to the added item (an object of type CFDataRef), specify kSecReturnPersistentRef with a value of kCFBooleanTrue. Note that unlike normal references, a persistent reference may be stored on disk or passed between processes.


It turns out that a persistent reference is just that, a reference. It can be used as key to lookup the keychain item later, share the reference between applications that have access to shared keychain items, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜