title: Cocoa interface to MacOS X Keychain
body: <p>I've got a bit of Mac code that needs to store, access and update passwords in order to connect users with a web API. The right place to put this information should be the Mac Keychain, but there doesn't seem to be a cocoa interface (see <a href="https://stackoverflow.com/a/2785868/28035">this answer</a>) -- is this still correct?</p>
  
  <p>I've looked at Apple's <a href="https://developer.apple.com/library/mac/#documentation/Security/Conceptual/keychainServConcepts/01introduction/introduction.html" rel="nofollow noreferrer">Keychain documentation</a>, and the API seems incredibly clunky. I can store to it and retrieve records, but anything more complex seems to require a lot of thought as to what might go wrong (see <a href="https://developer.apple.com/library/mac/#documentation/Security/Reference/keychainservices/Reference/reference.html#//apple_ref/doc/uid/TP30000898-CH5g-CJBEABHG" rel="nofollow noreferrer">this list of error codes</a>).</p>
  
  <p>Is there a better interface to the Mac keychain, aside from slogging through the C code? The closest I've come is <a href="https://github.com/irons/EMKeychain" rel="nofollow noreferrer">EMKeychain</a> but it seems like it needs a bit of work (e.g. no error handling code aside from spitting to the console).</p>