The KeyChain is an API for save storage of user passwords and other authentication information.
See CarbonCompatibility for some Cocoa implementations.
You might also want to take a look at this SourceForge project http://sourceforge.net/projects/keychain/.
Cocoa Wrapper Class for Keychain - http://extendmac.com/EMKeychain
Simple Keychain Example (Add, remove, modify, get) - http://agerson.net/example-some-common-uses-keychain
Code from “Core Mac OS X and Unix Programming” - http://borkware.com/corebook/source-code
Introduction to Keychain Services Reference - http://developer.apple.com/documentation/Security/Reference/keychainservices/index.html