| Framework | CoreServices/CoreServices.h, Carbon/Carbon.h |
| Declared in | KeychainCore.h KeychainHI.h |
The Keychain Manager is an API that provides a uniform way for your application to handle passwords for multiple users, multiple databases, or any situation in which a user must enter single or multiple passwords. You can use the Keychain Manager to provide secure storage for a user's passwords, cryptographic keys, and digital certificates.
This document, which describes KeychainLib 2.0, is relevant to you if your application needs to create and manage passwords and other secure data.
Important: Keychain Manager is being phased out and replaced by Keychain Services. Any new development should use Keychain Services. See Keychain Services Reference.
Carbon fully supports the Keychain Manager.
KCMakeKCRefFromFSSpec Deprecated in Mac OS X v10.5
KCMakeAliasFromKCRef Deprecated in Mac OS X v10.6
KCMakeKCRefFromAlias Deprecated in Mac OS X v10.6
KCReleaseKeychain Deprecated in Mac OS X v10.6
KCCountKeychains Deprecated in Mac OS X v10.6
KCCreateKeychain Deprecated in Mac OS X v10.6
kccreatekeychain Deprecated in Mac OS X v10.6
KCGetDefaultKeychain Deprecated in Mac OS X v10.6
KCGetIndKeychain Deprecated in Mac OS X v10.6
KCGetKeychainName Deprecated in Mac OS X v10.6
kcgetkeychainname Deprecated in Mac OS X v10.6
KCGetStatus Deprecated in Mac OS X v10.6
KCSetDefaultKeychain Deprecated in Mac OS X v10.6
KCAddAppleSharePassword Deprecated in Mac OS X v10.6
kcaddapplesharepassword Deprecated in Mac OS X v10.6
KCAddGenericPassword Deprecated in Mac OS X v10.6
kcaddgenericpassword Deprecated in Mac OS X v10.6
KCAddInternetPassword Deprecated in Mac OS X v10.6
kcaddinternetpassword Deprecated in Mac OS X v10.6
KCAddInternetPasswordWithPath Deprecated in Mac OS X v10.6
kcaddinternetpasswordwithpath Deprecated in Mac OS X v10.6
KCFindAppleSharePassword Deprecated in Mac OS X v10.6
kcfindapplesharepassword Deprecated in Mac OS X v10.6
KCFindGenericPassword Deprecated in Mac OS X v10.6
kcfindgenericpassword Deprecated in Mac OS X v10.6
KCFindInternetPassword Deprecated in Mac OS X v10.6
kcfindinternetpassword Deprecated in Mac OS X v10.6
KCFindInternetPasswordWithPath Deprecated in Mac OS X v10.6
kcfindinternetpasswordwithpath Deprecated in Mac OS X v10.6
KCNewItem Deprecated in Mac OS X v10.6
KCReleaseItem Deprecated in Mac OS X v10.6
KCAddItem Deprecated in Mac OS X v10.6
KCCopyItem Deprecated in Mac OS X v10.6
KCDeleteItem Deprecated in Mac OS X v10.6
KCGetKeychain Deprecated in Mac OS X v10.6
KCUpdateItem Deprecated in Mac OS X v10.6
KCGetAttribute Deprecated in Mac OS X v10.6
KCGetData Deprecated in Mac OS X v10.6
KCSetAttribute Deprecated in Mac OS X v10.6
KCSetData Deprecated in Mac OS X v10.6
KCFindFirstItem Deprecated in Mac OS X v10.6
KCFindNextItem Deprecated in Mac OS X v10.6
KCReleaseSearch Deprecated in Mac OS X v10.6
KCChangeSettings Deprecated in Mac OS X v10.6
KCIsInteractionAllowed Deprecated in Mac OS X v10.6
KCLock Deprecated in Mac OS X v10.6
KCSetInteractionAllowed Deprecated in Mac OS X v10.6
KCUnlock Deprecated in Mac OS X v10.6
kcunlock Deprecated in Mac OS X v10.6
KCAddCallback Deprecated in Mac OS X v10.6
KCRemoveCallback Deprecated in Mac OS X v10.6
DisposeKCCallbackUPP Deprecated in Mac OS X v10.6
InvokeKCCallbackUPP Deprecated in Mac OS X v10.6
NewKCCallbackUPP Deprecated in Mac OS X v10.6
Displays a list of certificates that the user can choose from.
Unsupported
OSStatus KCChooseCertificate ( CFArrayRef items, KCItemRef *certificate, CFArrayRef policyOIDs, KCVerifyStopOn stopOn );
An array of certificate references.
If the items array
only contains one certificate, on return, a pointer to that certificate.
In this case, no user interface is displayed.
An array of trust policy options used for
Macintosh file signing. To obtain a pointer to this array, call
the function SecMacGetDefaultPolicyOIDs.
The criteria to use in selecting the certificates to display. See “Certificate Verification Criteria” for a description of this mask.
A result
code. See “Keychain Manager Result Codes.” The result code userCanceledErr indicates
that the user pressed the Cancel button in the user interface.
The KCChooseCertificate function
displays a list of the certificates from which the user can choose.
If only one certificate matches the criteria, the reference is passed
back in the certificate parameter
and no user interface is presented.
Available beginning with KeychainLib 2.0.
This function is obsolete. There is currently no replacement.
KeychainHI.hFinds the certificates in a keychain that match specified search criteria.
Unsupported
OSStatus KCFindX509Certificates ( KCRef keychain, CFStringRef name, CFStringRef emailAddress, KCCertSearchOptions options, CFMutableArrayRef *certificateItems );
A reference to the keychain you want to search. If the keychain is locked, the Unlock Keychain dialog box is automatically displayed.
A pointer to a C string containing the certificate owner's common name.
A pointer to a C string containing the certificate owner’s email address.
The search criteria you wish to use. See “Certificate Search Options” for a description of this mask.
On return, a pointer to a list of the matching
certificates. Pass NULL if
you don’t want to obtain these references.
A result
code. See “Keychain Manager Result Codes.” The result code errKCNoDefaultKeychain indicates
that a default keychain was not found. The result code errKCBufferTooSmall indicates
that the certificate data was too large for the supplied buffer.
In this case, you should allocate a new buffer of sufficient size
before calling KCFindX509Certificates again.
The result code errKCItemNotFound indicates
that no matching certificate was found.
Available beginning with KeychainLib 2.0.
This function is obsolete. There is currently no replacement.
KeychainHI.hDetermines the version of the Keychain Manager installed on the user’s system.
Not Recommended
OSStatus KCGetKeychainManagerVersion ( UInt32 *returnVers );
On return, a pointer to the version number of the Keychain Manager installed on the current system.
A result code. See “Keychain Manager Result Codes.”
Your application can call the KCGetKeychainManagerVersion function
to find out which version of the Keychain Manager is installed on
the user's system.
Available beginning with KeychainLib 1.0.
Use the SecKeychainGetVersion function
in Keychain Services instead.
KeychainCore.hDefines a pointer to your keychain event callback that handles user keychain access events.
typedef OSStatus (*KCCallbackProcPtr) ( KCEvent keychainEvent, KCCallbackInfo * info, void * userContext );
If you name your function MyKCCallbackProc,
you would declare it like this:
OSStatus MyKCCallbackProc ( KCEvent keychainEvent, KCCallbackInfo * info, void * userContext );
The keychain event that your application wishes
to be notified of. See “Keychain Events Constants” for a description of possible values.
The type of event that can trigger your callback depends on the
bitmask you passed in the eventMask parameter
of the function KCAddCallback.
For more information, see the discussion.
A pointer to a structure of type KCCallbackInfo. On
return, the structure contains information about the keychain event
that occurred. The Keychain Manager passes this information to your
callback function via the info parameter
of the function InvokeKCCallbackUPP.
A pointer to application-defined storage that
your application previously passed to the function KCAddCallback. You can use this value
to perform operations such as tracking which instance of a function
is operating.
A result
code. See “Keychain Manager Result Codes.” Your keychain event callback
function should process the keychain event and return noErr.
Your keychain event callback function handles those keychain
events that you indicate. In order to be notified of these events,
you must pass a UPP to your notification callback function in the callbackProc parameter
of KCAddCallback. You
indicate the type of data transfer events you want to receive via
a bitmask in the eventMask parameter.
When you no longer wish to receive notification of keychain events,
you should call the function KCRemoveCallback to
dispose of the UPP to your keychain event callback function.
Use the SecKeychainCalllback function
in Keychain Services instead.
KeychainCore.hRepresents a 16-byte Apple File Protocol server signature block.
typedef UInt8 AFPServerSignature[16];
The AFPServerSignature type
represents a 16-byte Apple File Protocol server signature block.
You can pass a value of this type in the serverSignature parameter
of the functions KCAddAppleSharePassword and KCFindAppleSharePassword to
represent an Apple File Protocol server signature. You can use a
value of this type with the keychain item attribute constant kSignatureKCItemAttr to
specify an Apple File Protocol server signature.
KeychainCore.hContains information about a keychain item attribute.
typedef SecKeychainAttribute KCAttribute;
The KCAttribute type
represents a structure containing information about the attribute
of a keychain item. It contains a tag that identifies a particular
keychain item attribute value, the length of the attribute value,
and a pointer to the attribute value. You can modify attribute data
for a keychain item attribute by passing a pointer to this structure
in the attr parameter
of the function KCSetAttribute.
The function KCGetAttribute passes
back a pointer to this structure in the attr parameter.
KeychainCore.hLists attributes in a keychain item.
typedef SecKeychainAttributeList KCAttributeList;
The KCAttributeList type
represents a list of structures containing information about the attributes
in a keychain item. You pass a pointer to this list of 0 or more
structures in the attrList parameter
of the function KCFindFirstItem to
indicate the attributes to be matched.
KeychainCore.hIdentifies a keychain item attribute value.
typedef SecKeychainAttrType KCAttrType;
The KCAttrType type
represents a tag that identifies a keychain item attribute value.
You can use this value in the tag field
of the structure KCAttribute to
identify the keychain item attribute value you wish to set or obtain.
See Keychain Item Attribute Tag Constants for a description of the Apple-defined tag constants
and the data types of the values they identify. Your application
can create application-defined tags of type KCAttrType.
KeychainCore.hContains information about a keychain event.
struct KCCallbackInfo {
UInt32 version;
KCItemRef item;
long processID[2];
long event[4];
KCRef keychain;
};
typedef struct KCCallbackInfo KCCallbackInfo;
versionThe version of this structure.
itemA reference to the keychain item in which the event occurred. If the event did not involve an item, this field is not valid.
processIDA 64-bit quantity containing the process serial number of the process in which the event occurred. This is not available on Mac OS X.
eventThe keychain event that occurred. If the event
is a system event as indicated by the constant kSystemKCEvent,
the Keychain client can process events. If the event is not a system
event, this field is not valid. This is not available on Mac OS
X.
keychainA reference to the keychain in which the event occurred. If the event did not involve a keychain, this field is not valid.
The KCCallbackInfo type
represents a structure that contains information about the keychain
event of which your application wants to be notified. The Keychain
Manager passes a pointer to this structure in the info parameter
of your callback function via the function InvokeKCCallbackUPP, which invokes your
callback function. For information on how to write a keychain event
callback function, see KCCallbackProcPtr.
KeychainCore.hDefines a data type for the KCCallbackProcPtr callback
pointer.
typedef KCCallbackProcPtr KCCallbackUPP;
KeychainCore.hRepresents a reference to a keychain item.
typedef SecKeychainItemRef KCItemRef;
The KCItemRef type
represents a reference to an opaque structure that identifies a
keychain item. You should call the function KCNewItem to create a keychain item
reference. The function KCReleaseItem disposes
of a keychain item reference when no longer needed.
KeychainCore.hRepresents a 20-byte public key hash.
typedef UInt8 KCPublicKeyHash[20];
The KCPublicKeyHash type
represents a hash of a public key. You can use the constant kPublicKeyHashKCItemAttr,
described in Keychain Item Attribute Tag Constants, to set or retrieve a certificate
attribute value of this type.
KeychainCore.hRepresents a reference to a keychain.
typedef SecKeychainRef KCRef;
The KCRef type
represents a reference to an opaque structure that identifies a
keychain. You should call the function KCMakeKCRefFromFSSpec or KCMakeKCRefFromAlias to create a keychain
reference. The function KCReleaseKeychain disposes
of a keychain reference when no longer needed. You pass a reference
of this type to Keychain Manager functions that operate on a keychain
in some way.
KeychainCore.hRepresents a reference to the current search criteria.
typedef SecKeychainSearchRef KCSearchRef;
The KCSearchRef type
represents a reference to an opaque structure that identifies the current
search criteria. The function KCFindFirstItem passes
back a reference of this type in the search parameter
for subsequent calls to the function KCFindNextItem. You must release this
reference when you are finished with a search by calling the function KCReleaseSearch.
KeychainCore.hIdentifies a mask that you can use in determining the permissions that are set in a keychain.
typedef SecKeychainStatus KCStatus;
The KCStatus enumeration
defines masks your application can use to determine the read and
write permissions for a keychain. The function KCGetStatus passes back this mask in the status parameter.
KeychainCore.hRepresent the type of authentication to use in storing and retrieving Internet passwords.
enum {
kKCAuthTypeNTLM = 'ntlm',
kKCAuthTypeMSN = 'msna',
kKCAuthTypeDPA = 'dpaa',
kKCAuthTypeRPA = 'rpaa',
kKCAuthTypeHTTPDigest = 'httd',
kKCAuthTypeDefault = 'dflt'
};
typedef FourCharCode KCAuthType;
kKCAuthTypeNTLMSpecifies Windows NT LAN Manager authentication.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKCAuthTypeMSNSpecifies Microsoft Network authentication.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKCAuthTypeDPASpecifies Distributed Password authentication.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKCAuthTypeRPASpecifies Remote Password authentication.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKCAuthTypeHTTPDigestSpecifies HTTP Digest Access authentication.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKCAuthTypeDefaultSpecifies default authentication.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
The KCAuthType enumeration
defines constants you can use to identify the type of authentication
to use in storing and retrieving Internet passwords. You can pass
a constant of this type in the authType parameter
of the functions KCAddInternetPassword, KCAddInternetPasswordWithPath, KCFindInternetPassword,
and KCFindInternetPasswordWithPath.
Represent a mask that specifies the search criteria to use when finding certificates.
typedef UInt32 KCCertSearchOptions;
enum {
kCertSearchShift = 0,
kCertSearchSigningIgnored = 0,
kCertSearchSigningAllowed = 1 << (kCertSearchShift + 0),
kCertSearchSigningDisallowed = 1 << (kCertSearchShift + 1),
kCertSearchSigningMask = ((kCertSearchSigningAllowed) |
(kCertSearchSigningDisallowed)),
kCertSearchVerifyIgnored = 0,
kCertSearchVerifyAllowed = 1 << (kCertSearchShift + 2),
kCertSearchVerifyDisallowed = 1 << (kCertSearchShift + 3),
kCertSearchVerifyMask = ((kCertSearchVerifyAllowed) |
(kCertSearchVerifyDisallowed)),
kCertSearchEncryptIgnored = 0,
kCertSearchEncryptAllowed = 1 << (kCertSearchShift + 4),
kCertSearchEncryptDisallowed = 1 << (kCertSearchShift + 5),
kCertSearchEncryptMask = ((kCertSearchEncryptAllowed) |
(kCertSearchEncryptDisallowed)),
kCertSearchDecryptIgnored = 0,
kCertSearchDecryptAllowed = 1 << (kCertSearchShift + 6),
kCertSearchDecryptDisallowed = 1 << (kCertSearchShift + 7),
kCertSearchDecryptMask = ((kCertSearchDecryptAllowed) |
(kCertSearchDecryptDisallowed)),
kCertSearchWrapIgnored = 0,
kCertSearchWrapAllowed = 1 << (kCertSearchShift + 8),
kCertSearchWrapDisallowed = 1 << (kCertSearchShift + 9),
kCertSearchWrapMask = ((kCertSearchWrapAllowed) |
(kCertSearchWrapDisallowed)),
kCertSearchUnwrapIgnored = 0,
kCertSearchUnwrapAllowed = 1 << (kCertSearchShift + 10),
kCertSearchUnwrapDisallowed = 1 << (kCertSearchShift + 11),
kCertSearchUnwrapMask = ((kCertSearchUnwrapAllowed) |
(kCertSearchUnwrapDisallowed)),
kCertSearchPrivKeyRequired = 1 << (kCertSearchShift + 12),
kCertSearchAny = 0
};
The KCCertSearchOptions enumeration
defines masks that you can use in the options parameter
of the function KCFindX509Certificates.
Represent a mask that specifies the usage options when adding certificates.
typedef UInt32 KCCertAddOptions;
enum {
kSecOptionReserved = 0x000000FF,
kCertUsageShift = 8,
kCertUsageSigningAdd = 1 << (kCertUsageShift + 0),
kCertUsageSigningAskAndAdd = 1 << (kCertUsageShift + 1),
kCertUsageVerifyAdd = 1 << (kCertUsageShift + 2),
kCertUsageVerifyAskAndAdd = 1 << (kCertUsageShift + 3),
kCertUsageEncryptAdd = 1 <<(kCertUsageShift + 4),
kCertUsageEncryptAskAndAdd = 1 << (kCertUsageShift + 5),
kCertUsageDecryptAdd = 1 << (kCertUsageShift + 6),
kCertUsageDecryptAskAndAdd = 1 << (kCertUsageShift + 7),
kCertUsageKeyExchAdd = 1 << (kCertUsageShift + 8),
kCertUsageKeyExchAskAndAdd = 1 << (kCertUsageShift + 9),
kCertUsageRootAdd = 1 << (kCertUsageShift + 10),
kCertUsageRootAskAndAdd = 1 << (kCertUsageShift + 11),
kCertUsageSSLAdd = 1 << (kCertUsageShift + 12),
kCertUsageSSLAskAndAdd = 1 << (kCertUsageShift + 13),
kCertUsageAllAdd = 0x7FFFFF00
};
Identify the verification criteria for use when displaying certificates to the user.
typedef UInt16 KCVerifyStopOn;
enum {
kPolicyKCStopOn = 0,
kNoneKCStopOn = 1,
kFirstPassKCStopOn = 2,
kFirstFailKCStopOn = 3
};
kPolicyKCStopOnIndicates that the function KCChooseCertificate should use the trust
policy options currently in effect.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kNoneKCStopOnIndicates that the function KCChooseCertificate completes after
examining all available certificates.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kFirstPassKCStopOnIndicates that the function KCChooseCertificate when one certificate meeting
the verification criteria is found.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kFirstFailKCStopOnSpecifies that the function KCChooseCertificate completes when one certificate
that fails to meet the verification criteria is found.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
The KCVerifyStopOn enumeration
defines constants your application can use to identify the verification
criteria to use in selecting certificates. You can pass a constant
of this type in the stopOn parameter
of the function KCChooseCertificate.
Represent the internet ports available.
enum {
kAnyPort = 0
};
kAnyPortIndicates that any Internet port can be used.
Available in Mac OS X v10.1 and later.
Declared in KeychainCore.h.
Represent the internet protocols and authentication types available.
enum {
kAnyProtocol = 0,
kAnyAuthType = 0
};
kAnyProtocolIndicates that any Internet protocol can be used.
Available in Mac OS X v10.1 and later.
Declared in KeychainCore.h.
kAnyAuthTypeIndicates that any Internet authentication type can be used.
Available in Mac OS X v10.1 and later.
Declared in KeychainCore.h.
Identify keychain events.
typedef UInt16 KCEvent;
enum {
kIdleKCEvent = 0,
kLockKCEvent = 1,
kUnlockKCEvent = 2,
kAddKCEvent = 3,
kDeleteKCEvent = 4,
kUpdateKCEvent = 5,
kPasswordChangedKCEvent = 6,
kSystemKCEvent = 8,
kDefaultChangedKCEvent = 9,
kDataAccessKCEvent = 10,
kKeychainListChangedKCEvent = 11
};
kIdleKCEventIndicates a NULL event.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kLockKCEventIndicates that the keychain was locked.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kUnlockKCEventIndicates that the keychain was unlocked.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kAddKCEventIndicates that an item was added to a keychain.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kDeleteKCEventIndicates that an item was deleted from a keychain.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kUpdateKCEventIndicates that a keychain item was updated.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kPasswordChangedKCEventIndicates that the identity of the keychain was changed.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kSystemKCEventIndicates that the keychain client can process events.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kDefaultChangedKCEventIndicates that the default keychain has changed.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kDataAccessKCEventIndicates that a process has called the function KCGetData to access
a keychain item’s data.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKeychainListChangedKCEventIndicates that the list of keychains has changed.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
The KCEvent enumeration
defines constants that identify the Keychain-related events your callback
function wishes to receive. The Keychain Manager tests a mask that
you pass in the eventMask parameter
of the function KCAddCallback to
determine the data transfer events your notification callback function
wishes to receive. It passes these events in the keychainEvent parameter
of the function InvokeKCCallbackUPP.
For a description of the Keychain-related event masks, see Keychain Events Mask.
Identify a mask that you can use to set the keychain events you wish to receive.
typedef UInt16 KCEventMask;
enum {
kIdleKCEventMask = 1 << kIdleKCEvent,
kLockKCEventMask = 1 << kLockKCEvent,
kUnlockKCEventMask = 1 << kUnlockKCEvent,
kAddKCEventMask = 1 << kAddKCEvent,
kDeleteKCEventMask = 1 << kDeleteKCEvent,
kUpdateKCEventMask = 1 << kUpdateKCEvent,
kPasswordChangedKCEventMask = 1 << kPasswordChangedKCEvent,
kSystemEventKCEventMask = 1 << kSystemKCEvent,
kDefaultChangedKCEventMask = 1 << kDefaultChangedKCEvent,
kDataAccessKCEventMask = 1 << kDataAccessKCEvent,
kEveryKCEventMask = 0xFFFF
};
kIdleKCEventMaskIf the bit specified by this mask is set, your
callback function will be invoked during a NULL event.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kLockKCEventMaskIf the bit specified by this mask is set, your callback function will be invoked when the keychain is locked.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kUnlockKCEventMaskIf the bit specified by this mask is set, your callback function will be invoked when the keychain is unlocked.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kAddKCEventMaskIf the bit specified by this mask is set, your callback function will be invoked when an item is added to the keychain.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kDeleteKCEventMaskIf the bit specified by this mask is set, your callback function will be invoked when an item is removed from the keychain.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kUpdateKCEventMaskIf the bit specified by this mask is set, your callback function will be invoked when a keychain item is updated.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kPasswordChangedKCEventMaskIf the bit specified by this mask is set, your callback function will be invoked when the keychain identity is changed.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kSystemEventKCEventMaskIf the bit specified by this mask is set, your callback function will be invoked when the keychain client processes an event.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kDefaultChangedKCEventMaskIf the bit specified by this mask is set, your callback function will be invoked when the default keychain is changed.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kDataAccessKCEventMaskIf the bit specified by this mask is set, your
callback function will be invoked when a process calls the function KCGetData.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kEveryKCEventMaskIf the bit specified by this mask is set, your callback function will be invoked when any of the above Keychain-related events occur.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
The KCEventMask enumeration
defines masks your application can use to set Keychain event bits.
You pass this mask in the eventMask parameter
of the function KCAddCallback, thereby
defining the Keychain-related events to which your callback will
respond. The Keychain Manager uses this mask to test which events
your callback function will handle. It passes these events in the keychainEvent parameter
of the function InvokeKCCallbackUPP. For
a description of Keychain-related events, see Keychain Events Constants.
Represent tags that identify keychain item attribute values.
enum {
kClassKCItemAttr = 'clas',
kCreationDateKCItemAttr = 'cdat',
kModDateKCItemAttr = 'mdat',
kDescriptionKCItemAttr = 'desc',
kCommentKCItemAttr = 'icmt',
kCreatorKCItemAttr = 'crtr',
kTypeKCItemAttr = 'type',
kScriptCodeKCItemAttr = 'scrp',
kLabelKCItemAttr = 'labl',
kInvisibleKCItemAttr = 'invi',
kNegativeKCItemAttr = 'nega',
kCustomIconKCItemAttr = 'cusi',
kAccountKCItemAttr = 'acct',
kServiceKCItemAttr = 'svce',
kGenericKCItemAttr = 'gena',
kSecurityDomainKCItemAttr = 'sdmn',
kServerKCItemAttr = 'srvr',
kAuthTypeKCItemAttr = 'atyp',
kPortKCItemAttr = 'port',
kPathKCItemAttr = 'path',
kVolumeKCItemAttr = 'vlme',
kAddressKCItemAttr = 'addr',
kSignatureKCItemAttr = 'ssig',
kProtocolKCItemAttr = 'ptcl',
kSubjectKCItemAttr = 'subj',
kCommonNameKCItemAttr = 'cn ',
kIssuerKCItemAttr = 'issu',
kSerialNumberKCItemAttr = 'snbr',
kEMailKCItemAttr = 'mail',
kPublicKeyHashKCItemAttr = 'hpky',
kIssuerURLKCItemAttr = 'iurl',
kEncryptKCItemAttr = 'encr',
kDecryptKCItemAttr = 'decr',
kSignKCItemAttr = 'sign',
kVerifyKCItemAttr = 'veri',
kWrapKCItemAttr = 'wrap',
kUnwrapKCItemAttr = 'unwr',
kStartDateKCItemAttr = 'sdat',
kEndDateKCItemAttr = 'edat'
};
typedef FourCharCode KCItemAttr;
kClassKCItemAttrIdentifies the class attribute. You use this
tag to set or get a value of type KCItemClass that
indicates whether the item is an AppleShare, Internet, or generic
password, or a certificate. See “KCPublicKeyHash” for a description
of possible values.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kCreationDateKCItemAttrIdentifies the creation date attribute. You
use this tag to set or get a value of type UInt32 that
indicates the date the item was created.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kModDateKCItemAttrIdentifies the modification date attribute.
You use this tag to set or get a value of type UInt32 that
indicates the last time the item was updated.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kDescriptionKCItemAttrIdentifies the description attribute. You use
this tag to set or get a value of type string that
represents a user-visible string describing this item.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kCommentKCItemAttrIdentifies the comment attribute. You use this
tag to set or get a value of type string that
represents a user-editable string containing comments for this item.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kCreatorKCItemAttrIdentifies the creator attribute. You use this
tag to set or get a value of type OSType that
represents the item’s creator.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kTypeKCItemAttrIdentifies the type attribute. You use this
tag to set or get a value of type OSType that
represents the item’s type.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kScriptCodeKCItemAttrIdentifies the script code attribute. You use
this tag to set or get a value of type ScriptCode that
represents the script code for all strings.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kLabelKCItemAttrIdentifies the label attribute. You use this
tag to set or get a value of type string that
represents a user-editable string containing the label for this item.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kInvisibleKCItemAttrIdentifies the invisible attribute. You use
this tag to set or get a value of type Boolean that
indicates whether the item is invisible.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kNegativeKCItemAttrIdentifies the negative attribute. You use
this tag to set or get a value of type Boolean that
indicates whether there is a valid password associated with this
keychain item. This is useful if your application doesn't want a password
for some particular service to be stored in the keychain, but prefers
that it always be entered by the user. The item (typically invisible and
with zero-length data) acts as a placeholder to say “don't use
me.”
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kCustomIconKCItemAttrIdentifies the custom icon attribute. You use
this tag to set or get a value of type Boolean that
indicates whether the item has an application-specific icon. To
do this, you must also set the attribute value identified by the
tag kTypeKCItemAttr to a file type for which there is a corresponding
icon in the desktop database, and set the attribute value identified
by the tag kCreatorKCItemAttr to
an appropriate application creator type. If a custom icon corresponding
to the item's type and creator can be found in the desktop database,
it will be displayed by Keychain Access. Otherwise, default icons
are used.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kAccountKCItemAttrIdentifies the account attribute. You use this
tag to set or get a value of type Str63 that
represents the user account. It also applies to generic and AppleShare
passwords.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kServiceKCItemAttrIdentifies the service attribute for a generic
password. You use this tag to set or get a value of type Str63 that
represents the service.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kGenericKCItemAttrIdentifies the generic attribute for a generic password. You use this tag to set or get a value of untyped bytes that represents a user-defined attribute.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kSecurityDomainKCItemAttrIdentifies the security domain attribute for
an internet password. You use this tag to set or get a value of
type Str63 that represents
the Internet security domain.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kServerKCItemAttrIdentifies the server attribute for an internet
password. You use this tag to set or get a value of type string that
represents the Internet server’s domain name or IP address.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kAuthTypeKCItemAttrIdentifies the authentication type attribute
for an internet password. You use this tag to set or get a value
of type KCAuthType that
represents the Internet authentication scheme.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kPortKCItemAttrIdentifies the port attribute for an internet
password. You use this tag to set or get a value of type UInt16 that
represents the Internet port.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kPathKCItemAttrIdentifies the path attribute for an internet
password. You use this tag to set or get a value of type Str255 that
represents the path.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kVolumeKCItemAttrIdentifies the volume attribute for an AppleShare
password. You use this tag to set or get a value of type Str63 that
represents the AppleShare volume.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kAddressKCItemAttrIdentifies the address attribute for an AppleShare
password. You use this tag to set or get a value of type string that
represents the zone name, or the IP or domain name that represents
the server address.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kSignatureKCItemAttrIdentifies the server signature attribute for
an AppleShare password. You use this tag to set or get a value of
type KCPublicKeyHash that
represents the server signature block.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kProtocolKCItemAttrIdentifies the protocol attribute for an AppleShare
or internet password. You use this tag to set or get a value of
type KCProtocolType that
represents the Internet protocol.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kSubjectKCItemAttrIdentifies the subject attribute for a certificate.
You use this tag to set or get DER-encoded
data that represents the subject distinguished name.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kCommonNameKCItemAttrIdentifies the common name attribute for a
certificate. You use this tag to set or get a UTF8-encoded
string that represents the common name.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kIssuerKCItemAttrIdentifies the issuer attribute for a certificate.
You use this tag to set or get a DER-encoded
data that represents the issuer distinguished name.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kSerialNumberKCItemAttrIdentifies the serial number attribute for
a certificate. You use this tag to set or get a DER-encoded
data that represents the serial number.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kEMailKCItemAttrIdentifies the email attribute for a certificate.
You use this tag to set or get an ASCII-encoded
string that represents the issuer’s email address.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kPublicKeyHashKCItemAttrIdentifies the public key hash attribute for
a certificate. You use this tag to set or get a value of type KCPublicKeyHash that
represents the hash of the public key.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kIssuerURLKCItemAttrIdentifies the issuer URL attribute for a certificate.
You use this tag to set or get an ASCII-encoded
string that represents the URL of the certificate issuer.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kEncryptKCItemAttrIdentifies the encrypt attribute for a certificate
or key. You use this tag to set or get a value of type Boolean that
indicates whether the item can encrypt.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kDecryptKCItemAttrIdentifies the decrypt attribute for a certificate
or key. You use this tag to set or get a value of type Boolean that
indicates whether the item can decrypt.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kSignKCItemAttrIdentifies the sign attribute for a certificate
or key. You use this tag to set or get a value of type Boolean that
indicates whether the item can sign.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kVerifyKCItemAttrIdentifies the verify attribute for a certificate
or key. You use this tag to set or get a value of type Boolean that
indicates whether the item can verify.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kWrapKCItemAttrIdentifies the wrap attribute for a certificate
or key. You use this tag to set or get a value of type Boolean that
indicates whether the item can wrap.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kUnwrapKCItemAttrIdentifies the unwrap attribute for a certificate
or key. You use this tag to set or get a value of type Boolean that
indicates whether the item can unwrap.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kStartDateKCItemAttrIdentifies the start date attribute for a certificate
or key. You use this tag to set or get a value of type UInt32 that
indicates the start date.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kEndDateKCItemAttrIdentifies the end date attribute for a certificate
or key. You use this tag to set or get a value of type UInt32 that
indicates the end date.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
The KCItemAttr enumeration
defines the Apple-defined tag constants that identify keychain item
attribute values. Your application can use one of these tags in
the tag field of the
structure KCAttribute to
identify the keychain item attribute value you wish to set or retrieve.
Your application can create application-defined tags of type KCAttrType.
Identify the type of keychain item.
enum {
kCertificateKCItemClass = 'cert',
kAppleSharePasswordKCItemClass = 'ashp',
kInternetPasswordKCItemClass = 'inet',
kGenericPasswordKCItemClass = 'genp'
};
typedef FourCharCode KCItemClass;
kCertificateKCItemClassSpecifies that the item is a digital certificate.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kAppleSharePasswordKCItemClassSpecifies that the item is an AppleShare password.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kInternetPasswordKCItemClassSpecifies that the item is an Internet password.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kGenericPasswordKCItemClassSpecifies that the item is a generic password.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
The KCItemClass enumeration
defines constants your application can use to specify the type of
the keychain item you wish to create, dispose, add, delete, update,
copy, or locate. You pass a constant of this type to the functions KCNewItem, KCReleaseItem, KCAddItem, KCDeleteItem, KCUpdateItem, KCCopyItem, and KCGetKeychain. You
can also use these constants with the tag constant kClassKCItemAttr,
described in Keychain Item Attribute Tag Constants.
Identify the protocol to use in storing and retrieving Internet passwords.
enum {
kKCProtocolTypeFTP = 'ftp ',
kKCProtocolTypeFTPAccount = 'ftpa',
kKCProtocolTypeHTTP = 'http',
kKCProtocolTypeIRC = 'irc ',
kKCProtocolTypeNNTP = 'nntp',
kKCProtocolTypePOP3 = 'pop3',
kKCProtocolTypeSMTP = 'smtp',
kKCProtocolTypeSOCKS = 'sox ',
kKCProtocolTypeIMAP = 'imap',
kKCProtocolTypeLDAP = 'ldap',
kKCProtocolTypeAppleTalk = 'atlk',
kKCProtocolTypeAFP = 'afp ',
kKCProtocolTypeTelnet = 'teln'
};
typedef FourCharCode KCProtocolType;
kKCProtocolTypeFTPSpecifies the File Transfer Protocol.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKCProtocolTypeFTPAccountSpecifies the File Transfer Protocol Account.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKCProtocolTypeHTTPSpecifies the HyperText Transfer Protocol.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKCProtocolTypeIRCSpecifies the Internet Relay Channel Protocol.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKCProtocolTypeNNTPSpecifies the Network News Transfer Protocol.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKCProtocolTypePOP3Specifies the Post Office 3 Protocol.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKCProtocolTypeSMTPSpecifies the Simple Mail Transfer Protocol.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKCProtocolTypeSOCKSSpecifies the Secure Proxy Server Protocol.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKCProtocolTypeIMAPSpecifies the Internet Message Access Protocol.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKCProtocolTypeLDAPSpecifies the Lightweight Directory Access Protocol.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKCProtocolTypeAppleTalkSpecifies the AppleTalk Protocol.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKCProtocolTypeAFPSpecifies the AppleTalk File Protocol.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kKCProtocolTypeTelnetSpecifies the Telnet Protocol.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
The KCProtocolType enumeration
defines constants you can use to identify the type of authentication
to use in storing and retrieving Internet passwords. You can pass
a constant of this type in the protocol parameter
of the functions KCAddInternetPassword, KCAddInternetPasswordWithPath, KCFindInternetPassword,
and KCFindInternetPasswordWithPath.
Identify the keychain status.
enum {
kUnlockStateKCStatus = 1,
kRdPermKCStatus = 2,
kWrPermKCStatus = 4
};
kUnlockStateKCStatusIf the bit specified by this mask is set (bit 0), the keychain is unlocked.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kRdPermKCStatusIf the bit specified by this mask is set (bit 1), the keychain is unlocked with read permission.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
kWrPermKCStatusIf the bit specified by this mask is set (bit 2), the keychain is unlocked with write permission.
Available in Mac OS X v10.0 and later.
Declared in KeychainCore.h.
The most common result codes returned by Keychain Manager are listed below.
Last updated: 2005-07-07