What does kSecReturnPersistentRef do?

Does the key chain element persist between application launches?

+4
source share
3 answers

It turns out that a permalink is just a link. You can use it as a key to search for a keychain element later, share a link between applications that have access to common keychain elements, etc.

+2
source

Yes this is correct. Check out the Keyword Relations Guide :

To get a permanent link to the added item (an object of type CFDataRef), specify kSecReturnPersistentRef with the value kCFBooleanTrue. Note that unlike normal links, a permalink can be stored on disk or between processes.

+2
source

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

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

+2
source

Source: https://habr.com/ru/post/1335246/


All Articles