Contents

kSecUseDataProtectionKeychain

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

Declaration

let kSecUseDataProtectionKeychain: CFString

Mentioned in

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.