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

Editing the Keychain

With the item, you can also make changes using an attribute list:

OSStatus SecKeychainItemModifyContent (SecKeychainItemRef  itemRef,
                           const SecKeychainAttributeList *attrList, 
                                                   UInt32  newPasswordLength, 
                                               const void *newPassword)

The new attribute values would go into the attrList. A new password would go into newPassword.

To delete an item:

OSStatus SecKeychainItemDelete (SecKeychainItemRef itemRef)

Note that you would still have to call CFRelease() on the item to prevent a memory leak.

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