Developer --> Technical Publications

     


Setting and Obtaining Keychain Item Data

The Keychain Manager provides the functions KCSetData and KCSetAttribute for setting or editing keychain data. KCSetData requires that you pass the length of the data and a pointer to that data as separate parameters, while KCSetAttribute requires that you pass a keychain item attribute structure. Before calling these functions, you must call the function KCUnlock if the keychain containing the item is locked. The keychain must permit read/write access in order for you to edit keychain item data.

You can set or edit any of the standard item attributes identified by the following tag constants: kDescriptionKCItemAttr , kCommentKCItemAttr , kLabelKCItemAttr , kCreatorKCItemAttr , kTypeKCItemAttr , and kCustomIconKCItemAttr . There is additional data you can set, depending upon the type of keychain item whose data you are manipulating. For more information, see "Keychain Item Attribute Tag Constants" .

To obtain keychain item data, call the function KCGetData or KCGetAttribute . KCGetData requires that you pass the length of the data and a pointer to that data as separate parameters, while KCGetAttribute requires that you pass a keychain item attribute structure.


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