Global Variable

kSecUseDataProtectionKeychain

A key whose value indicates whether to treat macOS keychain items like iOS keychain items.

Declaration

let kSecUseDataProtectionKeychain: CFString

Discussion

Set the value for this key to true in the query dictionary when accessing a macOS keychain item that behaves like an iOS keychain item. For example, use the data protection key when adding, searching for, or deleting an item to which the kSecAttrAccessible or kSecAttrAccessGroup attributes apply.

The data protection key affects operations only in macOS. Other platforms automatically behave as if the key is set to true, and ignore the key in the query dictionary. You can safely use the key on all platforms.

Items that you store or have stored in macOS with the kSecAttrSynchronizable attribute set to true also behave like iOS keychain items. However, a true value for that attribute additionally causes iCloud to synchronize the item across all the user’s devices. Use kSecUseDataProtectionKeychain to get the iOS behavior without synchronization.

See Also

Additional Item Search Keys

let kSecUseItemList: CFString

A key whose value is an array of items to search.

let kSecUseKeychain: CFString

A key whose value is a keychain to operate on.

let kSecUseOperationPrompt: CFString

A key whose value is an operation prompt.

let kSecUseNoAuthenticationUI: CFString

A key whose value is a Boolean indicating whether to disallow UI authentication.

Deprecated
let kSecUseAuthenticationUI: CFString

A key whose value indicates whether the user may be prompted for authentication.

let kSecUseAuthenticationContext: CFString

A key whose value indicates a local authentication context to use.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software