Carbon


KCNewItem

Header: Keychain.h Carbon status: Under Evaluation

Creates a reference to a keychain item.

OSStatus KCNewItem (
    KCItemClass itemClass, 
    OSType itemCreator, 
    UInt32 length, 
    const void *data, 
    KCItemRef *item
);
Parameter descriptions
itemClass

The type of keychain item that you wish to create. See “Keychain Item Type Constants” for a description of possible values.

itemCreator

The creator code of the application that owns this item.

length

The length of the data to be stored in this item.

data

A pointer to a buffer containing the data to be stored in this item. Before calling KCNewItem, allocate enough memory for the buffer to hold the data you want to store.

item

On return, a pointer to a reference to the newly-created item.

function result

A result code. The Memory Manager result code memFullErr indicates that you did not allocate enough memory in the current heap to create the item.

DISCUSSION

After calling the KCNewItem function, you should call the function KCAddItem if you wish to permanently store a password or other keychain item. Note that a copy of the data buffer pointed to by the data parameter is stored in the newly-created item.

SPECIAL CONSIDERATIONS

When you are done with a keychain item, you should call the function KCReleaseItem to release its memory. You should not use the item after its memory has been deallocated.

VERSION NOTES

Available beginning with Keychain Manager 1.0.


© 2000 Apple Computer, Inc. (Last Updated 7/17/2000)