EMKeychain : Download v1.0.1

What Is EMKeychain?

EMKeychain is a Cocoa wrapper class for Keychain, which has unfortunately been frozen in carbonite. It's much cleaner than interfacing with keychain yourself, is actively used in commercial-grade products, and is completely documented.


Adding a generic keychain item

[EMGenericKeychainItem addGenericKeychainItemForService:@"SomeAppService" withUsername:@"Joe" password:@"supersecure!"];

Adding an internet keychain item

[EMInternetKeychainItem addInternetKeychainItemForServer:@"apple.com" withUsername:@"sjobs" password:@"magic" path:@"/httpdocs" port:21 protocol:kSecProtocolTypeFTP];

Note that the "protocol" asks for a SecProtocolType.

Working with a keychain item

//Grab the keychain item.

EMInternetKeychainItem *keychainItem = [EMInternetKeychainItem internetKeychainItemForServer:@"apple.com" withUsername:@"sjobs" path:@"/httpdocs" port:21 protocol:kSecProtocolTypeFTP];

//Grab the password.

NSString *password = keychainItem.password;

//Change the username and password. (This automatically saves to keychain, etc.)

keychainItem.username = @"phil";

keychainItem.password = @"philsnewpassword";