Class Methods
passwordForService:account:
Returns a string containing the password for a given account and service, ornil if the Keychain doesn’t have a password for the given parameters.
The service for which to return the corresponding password.
The account for which to return the corresponding password.
Returns a string containing the password for a given account and service, or
nil if the Keychain doesn’t have a password for the given parameters.passwordForService:account:error:
Returns a string containing the password for a given account and service, ornil if the Keychain doesn’t have a password for the given parameters. Populates an error object if an error occurs.
The service for which to return the corresponding password.
The account for which to return the corresponding password.
Populated should an error occur.
Returns a string containing the password, or
nil if an error occurs.passwordDataForService:account:
Returns NSData containing the password for a given account and service, ornil if the Keychain doesn’t have a password for the given parameters.
The service for which to return the corresponding password.
The account for which to return the corresponding password.
Returns NSData containing the password for a given account and service, or
nil if the Keychain doesn’t have a password for the given parameters.passwordDataForService:account:error:
Returns NSData containing the password for a given account and service, ornil if the Keychain doesn’t have a password for the given parameters. Populates an error object if an error occurs.
The service for which to return the corresponding password.
The account for which to return the corresponding password.
Populated should an error occur.
Returns NSData containing the password, or
nil if an error occurs.deletePasswordForService:account:
Deletes a password from the Keychain.The service for which to delete the corresponding password.
The account for which to delete the corresponding password.
Returns
YES on success, or NO on failure.deletePasswordForService:account:error:
Deletes a password from the Keychain. Populates an error object if an error occurs.The service for which to delete the corresponding password.
The account for which to delete the corresponding password.
Populated should an error occur.
Returns
YES on success, or NO on failure.setPassword:forService:account:
Sets a password in the Keychain.The password to store in the Keychain.
The service for which to set the corresponding password.
The account for which to set the corresponding password.
Returns
YES on success, or NO on failure.setPassword:forService:account:error:
Sets a password in the Keychain. Populates an error object if an error occurs.The password to store in the Keychain.
The service for which to set the corresponding password.
The account for which to set the corresponding password.
Populated should an error occur.
Returns
YES on success, or NO on failure.setPasswordData:forService:account:
Sets a password in the Keychain using NSData.The password to store in the Keychain.
The service for which to set the corresponding password.
The account for which to set the corresponding password.
Returns
YES on success, or NO on failure.setPasswordData:forService:account:error:
Sets a password in the Keychain using NSData. Populates an error object if an error occurs.The password to store in the Keychain.
The service for which to set the corresponding password.
The account for which to set the corresponding password.
Populated should an error occur.
Returns
YES on success, or NO on failure.allAccounts
Returns an array containing the Keychain’s accounts, ornil if the Keychain has no accounts.
An array of dictionaries containing the Keychain’s accounts, or
nil if the Keychain doesn’t have any accounts. The order of the objects in the array isn’t defined.See the
NSString constants declared in SAMKeychain.h for a list of keys that can be used when accessing the dictionaries returned by this method.allAccounts:
Returns an array containing the Keychain’s accounts, ornil if the Keychain has no accounts. Populates an error object if an error occurs.
Populated should an error occur.
An array of dictionaries containing the Keychain’s accounts, or
nil if an error occurs. The order of the objects in the array isn’t defined.accountsForService:
Returns an array containing the Keychain’s accounts for a given service, ornil if the Keychain doesn’t have any accounts for the given service.
The service for which to return the corresponding accounts.
An array of dictionaries containing the Keychain’s accounts for a given
serviceName, or nil if the Keychain doesn’t have any accounts for the given serviceName. The order of the objects in the array isn’t defined.See the
NSString constants declared in SAMKeychain.h for a list of keys that can be used when accessing the dictionaries returned by this method.accountsForService:error:
Returns an array containing the Keychain’s accounts for a given service, ornil if the Keychain doesn’t have any accounts for the given service. Populates an error object if an error occurs.
The service for which to return the corresponding accounts.
Populated should an error occur.
An array of dictionaries containing the Keychain’s accounts for a given
serviceName, or nil if an error occurs. The order of the objects in the array isn’t defined.accessibilityType (iOS only)
Returns the accessibility type for all future passwords saved to the Keychain.Returns the accessibility type. The return value will be
NULL or one of the “Keychain Item Accessibility Constants” used for determining when a keychain item should be readable.This method is only available on iOS 4.0 and later.
setAccessibilityType: (iOS only)
Sets the accessibility type for all future passwords saved to the Keychain.One of the “Keychain Item Accessibility Constants” used for determining when a keychain item should be readable.
This method is only available on iOS 4.0 and later.
Constants
Error Domain
kSAMKeychainErrorDomain
Dictionary Keys
These constants are used as keys in the dictionaries returned byallAccounts, allAccounts:, accountsForService:, and accountsForService:error:.
kSAMKeychainAccountKey
kSAMKeychainCreatedAtKey
kSAMKeychainClassKey
kSAMKeychainDescriptionKey
kSAMKeychainLabelKey
kSAMKeychainLastModifiedKey
kSAMKeychainWhereKey
Error Codes
SAMKeychainErrorCode
Error codes specific to SAMKeychain that can be returned in NSError objects.SAMKeychainErrorBadArguments
Some of the arguments were invalid. Example:For error codes returned by the operating system, refer to SecBase.h for your platform.
