O'Reilly logo

Advanced Mac OS X Programming: The Big Nerd Ranch Guide by Mark Dalrymple

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required