A: 

Not sure about where to find better documentation, but sometimes good place to find example code is Google code search:

http://www.google.com/codesearch?q=SecKeychainFindGenericPassword&hl=en

Ken Aspeslagh
A: 

When I wrote the 24 Deadly Sins of Software Security, I added a section on using the KeyChain, but to be honest the documentation from Apple is very hard to find. I used the OpenDarwin site (opendarwin.org) but that has since died a death. Here's the code from the book:

// Set password SecKeychainRef keychain = NULL; // User's default keychain OSStatus status= SecKeychainAddGenericPassword(keychain, strlen(serviceName), serviceName, strlen(accountName), accountName, strlen(passwordData), passwordData, NULL);

if (status == noErr) { // cool! }

// Get password char *password = NULL; u_int_32_t passwordLen = 0;

status = SecKeychainFindGenericPassword(keychain, strlen(serviceName), serviceName, strlen(accountName), accountName, &passwordLen, &password, NULL);

if (status == noErr) { // Cool! Use pwd ...

// Now Cleanup
guaranteed_memset(password,42,passwordLen);
SecKeychainItemFreeContent(NULL, (void*)password);

}

Michael Howard-MSFT
Generic and internet passwords are fairly easy to handle if you use one of the frameworks I mentioned above. They even abstract from the ugly Carbon functions.
Rafael
+2  A: 

Advanced Mac OS X Programming has a nice chapter on Keychain service. The authors also complained about the documentation which looks like it was put together in the last minute before release, as you did.

That book is a bit dated, and not that advanced if you already have a unix background, but I found it still worth having on my bookshelf. Recommended.

Yuji