Specify how you want returned keychain item data formatted.
When you use one of the
Sec functions to add or search for keychain items, these functions return the item's data and attributes through the
result parameter to which you provide a pointer. Use the item result keys described below in the corresponding query dictionary to indicate how those results should be formatted:
If you request a persistent data reference using
k, the search returns an item reference of type CFData that you can store on disk or pass between processes. You later convert persistent references to regular references with another call to the
Sec Return Persistent Ref
Secfunction, using an array of persistent references (of the same item class) as the value for the
Item Copy Matching(_: _:)
Sec Match Item List
If you ask for the data itself with
k, the search returns a CFData instance that holds the actual data. This is typically what you want for password items. To undo the encryption it added prior to storing the item, keychain services decrypts the data before returning it to you.
Sec Return Data
If you request the item’s attributes using
kor more than one return type, the search returns a dictionary. Item attributes are represented directly as key-value pairs in this dictionary, while the item’s data appears in one or more of the previously mentioned forms, and is associated with the appropriate item value type key from Item Return Result Keys.
Sec Return Attributes
When you specify a match limit greater than one, the search produces an array. Each element of the array is itself a search result formatted according to the previous rules.