Developer --> Technical Publications

     


Manipulating Passwords

Your application can manipulate passwords and other keychain items by calling the functions KCAddItem , KCDeleteItem , KCUpdateItem , KCCopyItem , and KCGetKeychain . KCAddItem adds a password or other item to the default keychain. Adding a password is the most efficient way to create a keychain, since the Keychain Manager functions that add passwords automatically call the function KCCreateKeychain .

KCDeleteItem deletes an item from the default keychain. After calling KCDeleteItem , you should call the function KCReleaseItem when you are finished with an item, since KCDeleteItem does not dispose the memory occupied by the item reference.

KCUpdateItem writes an item to the keychain's permanent data store after changing its attributes. This function may display the Unlock Keychain dialog box if the keychain containing the item is currently locked. You can call the function KCCopyItem to copy an item from one keychain to another. The function KCGetKeychain retrieves the location of a keychain item.

You can call the function KCFindFirstItem to find the first password or other keychain item matching specified attributes. KCFindFirstItem passes back a reference to the item and to the current search criteria. You pass the search reference returned by to KCFindFirstItem to the function KCFindNextItem . KCFindNextItem finds the next keychain item matching the criteria used by KCFindFirstItem and returns a reference to the matching item, if any.

When you are completely finished with a search performed by calling the functions KCFindNextItem or KCFindNextItem , call the function KCReleaseSearch to release the memory occupied by the search criteria reference.


© 2000 Apple Computer, Inc. (Last Updated 20 July 2000)