Minimum Deployment Target
iOS 5.0 or laterPlatform-Specific Features
Accessibility Types
SAMKeychain provides iOS-specific accessibility control for keychain items through theaccessibilityType methods (available on iOS 4.0 and later).
If you set the value to
NULL (the default), the Keychain default will be used which is highly insecure. You should use at least kSecAttrAccessibleAfterFirstUnlock for background applications or kSecAttrAccessibleWhenUnlocked for all other applications.Available Accessibility Constants
kSecAttrAccessibleWhenUnlocked- Data can only be accessed while the device is unlockedkSecAttrAccessibleAfterFirstUnlock- Data can be accessed after the first unlock following a device restart (recommended for background apps)kSecAttrAccessibleAlways- Data is always accessible (not recommended for security reasons)kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly- Data is accessible only when the device is unlocked and a passcode is setkSecAttrAccessibleWhenUnlockedThisDeviceOnly- Data is accessible only when unlocked and won’t sync via iCloudkSecAttrAccessibleAfterFirstUnlockThisDeviceOnly- Same as AfterFirstUnlock but won’t sync via iCloudkSecAttrAccessibleAlwaysThisDeviceOnly- Always accessible but won’t sync via iCloud
Access Groups
Access groups allow sharing keychain items between apps from the same developer (available on iOS 3.0 and later).Access groups do not work in the iOS Simulator. This feature is only available on physical devices. See SAMKeychainQuery.m:216-220 for implementation details.
iCloud Keychain Synchronization
iCloud Keychain synchronization is available on iOS 7.0 and later.Synchronization Modes
SAMKeychainQuerySynchronizationModeAny- Query all items regardless of synchronization stateSAMKeychainQuerySynchronizationModeNo- Only local keychain items (not synchronized)SAMKeychainQuerySynchronizationModeYes- Only synchronized keychain items
The compile-time constant
SAMKEYCHAIN_SYNCHRONIZATION_AVAILABLE indicates if synchronization is available at compile time. Use [SAMKeychainQuery isSynchronizationAvailable] to check at runtime. See SAMKeychainQuery.m:189-197 for implementation.