Convenience Functions

That’s the whole story on keychains. There are some convenience functions that make common activities possible, but they simply use the functions that we have talked about already.

These functions allow you to create a new item without creating an attribute list:

OSStatus SecKeychainAddInternetPassword (SecKeychainRef keychain,
                            UInt32       serverNameLength, 
                            const char  *serverName, 
                            UInt32       securityDomainLength, 
                            const char  *securityDomain, 
                            UInt32       accountNameLength, 
                            const char  *accountName, 
                            UInt32       pathLength, 
                            const char  *path, 
                            UInt16       port, 
                            SecProtocolType       protocol, 
                            SecAuthenticationType authenticationType, 
                            UInt32       passwordLength, 
                            const void  *passwordData, 
                            SecKeychainItemRef    *itemRef)

OSStatus SecKeychainAddGenericPassword (SecKeychainRef ...

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.