19 #ifndef __KEYCHAINCORE__
20 #define __KEYCHAINCORE__
34 #ifndef __CODEFRAGMENTS__
63 #if PRAGMA_STRUCT_ALIGN
64 #pragma options align = mac68k
65 #elif PRAGMA_STRUCT_PACKPUSH
67 #elif PRAGMA_STRUCT_PACK
74 typedef struct OpaqueSecKeychainRef *SecKeychainRef;
75 typedef struct OpaqueSecKeychainItemRef *SecKeychainItemRef;
76 typedef struct OpaqueSecKeychainSearchRef *SecKeychainSearchRef;
77 typedef OSType SecKeychainAttrType;
78 typedef UInt32 SecKeychainStatus;
81 SecKeychainAttrType tag;
95 typedef SecKeychainRef KCRef;
96 typedef SecKeychainItemRef KCItemRef;
97 typedef SecKeychainSearchRef KCSearchRef;
100 typedef SecKeychainAttrType KCAttrType;
101 typedef SecKeychainStatus KCStatus;
102 typedef UInt16 KCEvent;
118 typedef UInt16 KCEventMask;
121 kIdleKCEventMask = 1 << kIdleKCEvent,
131 kEveryKCEventMask = 0xFFFF
134 typedef UInt8 AFPServerSignature[16];
135 typedef UInt8 KCPublicKeyHash[20];
147 kUnlockStateKCStatus = 1,
154 kCertificateKCItemClass = FOUR_CHAR_CODE(
'cert'),
156 FOUR_CHAR_CODE(
'ashp'),
158 FOUR_CHAR_CODE(
'inet'),
162 typedef FourCharCode KCItemClass;
168 FOUR_CHAR_CODE(
'cdat'),
170 FOUR_CHAR_CODE(
'mdat'),
172 FOUR_CHAR_CODE(
'desc'),
174 FOUR_CHAR_CODE(
'icmt'),
178 FOUR_CHAR_CODE(
'scrp'),
187 FOUR_CHAR_CODE(
'gena'),
190 FOUR_CHAR_CODE(
'sdmn'),
192 FOUR_CHAR_CODE(
'srvr'),
194 FOUR_CHAR_CODE(
'atyp'),
202 FOUR_CHAR_CODE(
'ssig'),
209 FOUR_CHAR_CODE(
'cn '),
215 FOUR_CHAR_CODE(
'mail'),
231 typedef FourCharCode KCItemAttr;
234 kKCAuthTypeNTLM = FOUR_CHAR_CODE(
'ntlm'),
235 kKCAuthTypeMSN = FOUR_CHAR_CODE(
'msna'),
236 kKCAuthTypeDPA = FOUR_CHAR_CODE(
'dpaa'),
237 kKCAuthTypeRPA = FOUR_CHAR_CODE(
'rpaa'),
238 kKCAuthTypeHTTPDigest = FOUR_CHAR_CODE(
'httd'),
239 kKCAuthTypeDefault = FOUR_CHAR_CODE(
'dflt')
242 typedef FourCharCode KCAuthType;
245 kKCProtocolTypeFTP = FOUR_CHAR_CODE(
'ftp '),
246 kKCProtocolTypeFTPAccount = FOUR_CHAR_CODE(
'ftpa'),
247 kKCProtocolTypeHTTP = FOUR_CHAR_CODE(
'http'),
248 kKCProtocolTypeIRC = FOUR_CHAR_CODE(
'irc '),
249 kKCProtocolTypeNNTP = FOUR_CHAR_CODE(
'nntp'),
250 kKCProtocolTypePOP3 = FOUR_CHAR_CODE(
'pop3'),
251 kKCProtocolTypeSMTP = FOUR_CHAR_CODE(
'smtp'),
252 kKCProtocolTypeSOCKS = FOUR_CHAR_CODE(
'sox '),
253 kKCProtocolTypeIMAP = FOUR_CHAR_CODE(
'imap'),
254 kKCProtocolTypeLDAP = FOUR_CHAR_CODE(
'ldap'),
255 kKCProtocolTypeAppleTalk = FOUR_CHAR_CODE(
'atlk'),
256 kKCProtocolTypeAFP = FOUR_CHAR_CODE(
'afp '),
257 kKCProtocolTypeTelnet = FOUR_CHAR_CODE(
'teln')
260 typedef FourCharCode KCProtocolType;
261 typedef UInt32 KCCertAddOptions;
281 kCertUsageAllAdd = 0x7FFFFF00
284 typedef UInt16 KCVerifyStopOn;
289 kFirstPassKCStopOn = 2,
290 kFirstFailKCStopOn = 3
293 typedef UInt32 KCCertSearchOptions;
296 kCertSearchShift = 0,
298 kCertSearchSigningAllowed = 1 << (kCertSearchShift + 0),
299 kCertSearchSigningDisallowed = 1 << (kCertSearchShift + 1),
300 kCertSearchSigningMask =
301 ((kCertSearchSigningAllowed) | (kCertSearchSigningDisallowed)),
302 kCertSearchVerifyIgnored = 0,
303 kCertSearchVerifyAllowed = 1 << (kCertSearchShift + 2),
304 kCertSearchVerifyDisallowed = 1 << (kCertSearchShift + 3),
305 kCertSearchVerifyMask =
306 ((kCertSearchVerifyAllowed) | (kCertSearchVerifyDisallowed)),
307 kCertSearchEncryptIgnored = 0,
308 kCertSearchEncryptAllowed = 1 << (kCertSearchShift + 4),
309 kCertSearchEncryptDisallowed = 1 << (kCertSearchShift + 5),
310 kCertSearchEncryptMask =
311 ((kCertSearchEncryptAllowed) | (kCertSearchEncryptDisallowed)),
312 kCertSearchDecryptIgnored = 0,
313 kCertSearchDecryptAllowed = 1 << (kCertSearchShift + 6),
314 kCertSearchDecryptDisallowed = 1 << (kCertSearchShift + 7),
315 kCertSearchDecryptMask =
316 ((kCertSearchDecryptAllowed) | (kCertSearchDecryptDisallowed)),
317 kCertSearchWrapIgnored = 0,
318 kCertSearchWrapAllowed = 1 << (kCertSearchShift + 8),
319 kCertSearchWrapDisallowed = 1 << (kCertSearchShift + 9),
320 kCertSearchWrapMask =
321 ((kCertSearchWrapAllowed) | (kCertSearchWrapDisallowed)),
322 kCertSearchUnwrapIgnored = 0,
323 kCertSearchUnwrapAllowed = 1 << (kCertSearchShift + 10),
324 kCertSearchUnwrapDisallowed = 1 << (kCertSearchShift + 11),
325 kCertSearchUnwrapMask =
326 ((kCertSearchUnwrapAllowed) | (kCertSearchUnwrapDisallowed)),
327 kCertSearchPrivKeyRequired = 1 << (kCertSearchShift + 12),
355 #if TARGET_RT_MAC_CFM
357 inline pascal
Boolean KeychainManagerAvailable()
364 #define KeychainManagerAvailable() \
365 ((KCGetKeychainManagerVersion != (void *)kUnresolvedCFragSymbolAddress) && \
366 (KCGetKeychainManagerVersion(nil) != cfragNoSymbolErr))
368 #elif TARGET_RT_MAC_MACHO
371 inline pascal
Boolean KeychainManagerAvailable() {
return true; }
373 #define KeychainManagerAvailable() (true)
479 UInt32 *keychainStatus);
526 typedef CALLBACK_API(OSStatus, KCCallbackProcPtr)(KCEvent keychainEvent,
540 #if !OPAQUE_UPP_TYPES
543 uppKCCallbackProcInfo = 0x00000FB0
549 (ProcPtr)(userRoutine), uppKCCallbackProcInfo, GetCurrentArchitecture());
552 #define NewKCCallbackUPP(userRoutine) \
553 (KCCallbackUPP) NewRoutineDescriptor( \
554 (ProcPtr)(userRoutine), uppKCCallbackProcInfo, GetCurrentArchitecture())
568 #if !OPAQUE_UPP_TYPES
575 #define DisposeKCCallbackUPP(userUPP) DisposeRoutineDescriptor(userUPP)
589 void *userContext, KCCallbackUPP userUPP);
590 #if !OPAQUE_UPP_TYPES
593 void *userContext, KCCallbackUPP userUPP)
595 return (OSStatus)CALL_THREE_PARAMETER_UPP(userUPP, uppKCCallbackProcInfo,
596 keychainEvent, info, userContext);
599 #define InvokeKCCallbackUPP(keychainEvent, info, userContext, userUPP) \
600 (OSStatus) CALL_THREE_PARAMETER_UPP((userUPP), uppKCCallbackProcInfo, \
601 (keychainEvent), (info), (userContext))
605 #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
607 #define NewKCCallbackProc(userRoutine) NewKCCallbackUPP(userRoutine)
608 #define CallKCCallbackProc(userRoutine, keychainEvent, info, userContext) \
609 InvokeKCCallbackUPP(keychainEvent, info, userContext, userRoutine)
646 KCNewItem(KCItemClass itemClass, OSType itemCreator, UInt32 length,
647 const void *data, KCItemRef *item);
680 KCSetData(KCItemRef item, UInt32 length,
const void *data);
714 KCCopyItem(KCItemRef item, KCRef destKeychain, KCItemRef *copy);
728 KCSearchRef *search, KCItemRef *item);
785 KCGetData(KCItemRef item, UInt32 maxLength,
void *data, UInt32 *actualLength);
800 UInt32 passwordLength,
const void *passwordData,
817 UInt32 maxLength,
void *passwordData,
818 UInt32 *actualLength,
833 OSType authType, UInt32 passwordLength,
834 const void *passwordData,
848 UInt16
port, OSType protocol, OSType authType,
849 UInt32 passwordLength,
const void *passwordData,
864 UInt16
port, OSType protocol, OSType authType,
865 UInt32 maxLength,
void *passwordData,
866 UInt32 *actualLength,
882 UInt16
port, OSType protocol, OSType authType,
883 UInt32 maxLength,
void *passwordData,
884 UInt32 *actualLength,
898 UInt32 passwordLength,
const void *passwordData,
912 UInt32 maxLength,
void *passwordData,
913 UInt32 *actualLength, KCItemRef *item);
937 const char *serverAddress,
const char *serverName,
938 const char *volumeName,
const char *accountName,
939 UInt32 passwordLength,
const void *passwordData,
952 const char *serverAddress,
953 const char *serverName,
954 const char *volumeName,
955 const char *accountName,
956 UInt32 maxLength,
void *passwordData,
957 UInt32 *actualLength,
970 const char *accountName, UInt16
port, OSType protocol,
971 OSType authType, UInt32 passwordLength,
972 const void *passwordData,
985 const char *securityDomain,
986 const char *accountName,
const char *path,
987 UInt16
port, OSType protocol, OSType authType,
988 UInt32 passwordLength,
const void *passwordData,
1001 const char *securityDomain,
1002 const char *accountName,
1003 UInt16
port, OSType protocol, OSType authType,
1004 UInt32 maxLength,
void *passwordData,
1005 UInt32 *actualLength,
1018 const char *securityDomain,
1019 const char *accountName,
1021 UInt16
port, OSType protocol, OSType authType,
1022 UInt32 maxLength,
void *passwordData,
1023 UInt32 *actualLength,
1036 UInt32 passwordLength,
const void *passwordData,
1049 const char *accountName,
1050 UInt32 maxLength,
void *passwordData,
1051 UInt32 *actualLength, KCItemRef *item);
1053 #if PRAGMA_STRUCT_ALIGN
1054 #pragma options align = reset
1055 #elif PRAGMA_STRUCT_PACKPUSH
1057 #elif PRAGMA_STRUCT_PACK
1061 #ifdef PRAGMA_IMPORT_OFF
1064 #pragma import reset
Alias Manager Interfaces.
Public Code Fragment Manager Interfaces.
Event Manager Interfaces.
File Manager (MFS, HFS, and HFS+) Interfaces.
OSStatus KCFindInternetPassword(StringPtr serverName, StringPtr securityDomain, StringPtr accountName, UInt16 port, OSType protocol, OSType authType, UInt32 maxLength, void *passwordData, UInt32 *actualLength, KCItemRef *item)
OSStatus KCGetStatus(KCRef keychain, UInt32 *keychainStatus)
OSStatus kcfindinternetpasswordwithpath(const char *serverName, const char *securityDomain, const char *accountName, const char *path, UInt16 port, OSType protocol, OSType authType, UInt32 maxLength, void *passwordData, UInt32 *actualLength, KCItemRef *item)
@ kDescriptionKCItemAttr
Definition: KeychainCore.h:171
@ kPublicKeyHashKCItemAttr
Definition: KeychainCore.h:216
@ kClassKCItemAttr
Definition: KeychainCore.h:166
@ kWrapKCItemAttr
Definition: KeychainCore.h:225
@ kCreatorKCItemAttr
Definition: KeychainCore.h:175
@ kCommentKCItemAttr
Definition: KeychainCore.h:173
@ kModDateKCItemAttr
Definition: KeychainCore.h:169
@ kProtocolKCItemAttr
Definition: KeychainCore.h:204
@ kCreationDateKCItemAttr
Definition: KeychainCore.h:167
@ kAccountKCItemAttr
Definition: KeychainCore.h:183
@ kEncryptKCItemAttr
Definition: KeychainCore.h:221
@ kCustomIconKCItemAttr
Definition: KeychainCore.h:182
@ kServerKCItemAttr
Definition: KeychainCore.h:191
@ kUnwrapKCItemAttr
Definition: KeychainCore.h:226
@ kEMailKCItemAttr
Definition: KeychainCore.h:214
@ kGenericKCItemAttr
Definition: KeychainCore.h:186
@ kSignKCItemAttr
Definition: KeychainCore.h:223
@ kDecryptKCItemAttr
Definition: KeychainCore.h:222
@ kIssuerURLKCItemAttr
Definition: KeychainCore.h:218
@ kSubjectKCItemAttr
Definition: KeychainCore.h:206
@ kServiceKCItemAttr
Definition: KeychainCore.h:185
@ kNegativeKCItemAttr
Definition: KeychainCore.h:181
@ kSecurityDomainKCItemAttr
Definition: KeychainCore.h:189
@ kIssuerKCItemAttr
Definition: KeychainCore.h:210
@ kPortKCItemAttr
Definition: KeychainCore.h:195
@ kInvisibleKCItemAttr
Definition: KeychainCore.h:180
@ kSignatureKCItemAttr
Definition: KeychainCore.h:201
@ kCommonNameKCItemAttr
Definition: KeychainCore.h:208
@ kScriptCodeKCItemAttr
Definition: KeychainCore.h:177
@ kPathKCItemAttr
Definition: KeychainCore.h:196
@ kEndDateKCItemAttr
Definition: KeychainCore.h:228
@ kAddressKCItemAttr
Definition: KeychainCore.h:199
@ kSerialNumberKCItemAttr
Definition: KeychainCore.h:212
@ kVerifyKCItemAttr
Definition: KeychainCore.h:224
@ kStartDateKCItemAttr
Definition: KeychainCore.h:227
@ kTypeKCItemAttr
Definition: KeychainCore.h:176
@ kLabelKCItemAttr
Definition: KeychainCore.h:179
@ kVolumeKCItemAttr
Definition: KeychainCore.h:198
@ kAuthTypeKCItemAttr
Definition: KeychainCore.h:193
OSStatus KCFindNextItem(KCSearchRef search, KCItemRef *item)
OSStatus KCCopyItem(KCItemRef item, KCRef destKeychain, KCItemRef *copy)
OSStatus KCFindFirstItem(KCRef keychain, const KCAttributeList *attrList, KCSearchRef *search, KCItemRef *item)
#define NewKCCallbackUPP(userRoutine)
Definition: KeychainCore.h:552
OSStatus kcfindgenericpassword(const char *serviceName, const char *accountName, UInt32 maxLength, void *passwordData, UInt32 *actualLength, KCItemRef *item)
OSStatus KCSetAttribute(KCItemRef item, KCAttribute *attr)
OSStatus KCGetIndKeychain(UInt16 index, KCRef *keychain)
OSStatus KCAddGenericPassword(StringPtr serviceName, StringPtr accountName, UInt32 passwordLength, const void *passwordData, KCItemRef *item)
OSStatus KCMakeAliasFromKCRef(KCRef keychain, AliasHandle *keychainAlias)
@ kCertSearchSigningIgnored
Definition: KeychainCore.h:297
OSStatus kcaddinternetpasswordwithpath(const char *serverName, const char *securityDomain, const char *accountName, const char *path, UInt16 port, OSType protocol, OSType authType, UInt32 passwordLength, const void *passwordData, KCItemRef *item)
OSStatus KCAddInternetPasswordWithPath(StringPtr serverName, StringPtr securityDomain, StringPtr accountName, StringPtr path, UInt16 port, OSType protocol, OSType authType, UInt32 passwordLength, const void *passwordData, KCItemRef *item)
OSStatus KCMakeKCRefFromFSSpec(FSSpec *keychainFSSpec, KCRef *keychain)
OSStatus KCFindAppleSharePassword(AFPServerSignature *serverSignature, StringPtr serverAddress, StringPtr serverName, StringPtr volumeName, StringPtr accountName, UInt32 maxLength, void *passwordData, UInt32 *actualLength, KCItemRef *item)
OSStatus KCReleaseItem(KCItemRef *item)
@ kAppleSharePasswordKCItemClass
Definition: KeychainCore.h:155
@ kGenericPasswordKCItemClass
Definition: KeychainCore.h:159
@ kInternetPasswordKCItemClass
Definition: KeychainCore.h:157
OSStatus KCLock(KCRef keychain)
OSStatus KCGetKeychainManagerVersion(UInt32 *returnVers)
@ kCertUsageShift
Definition: KeychainCore.h:266
@ kCertUsageSigningAdd
Definition: KeychainCore.h:267
OSStatus kcfindinternetpassword(const char *serverName, const char *securityDomain, const char *accountName, UInt16 port, OSType protocol, OSType authType, UInt32 maxLength, void *passwordData, UInt32 *actualLength, KCItemRef *item)
OSStatus kcfindapplesharepassword(AFPServerSignature *serverSignature, const char *serverAddress, const char *serverName, const char *volumeName, const char *accountName, UInt32 maxLength, void *passwordData, UInt32 *actualLength, KCItemRef *item)
OSStatus InvokeKCCallbackUPP(KCEvent keychainEvent, KCCallbackInfo *info, void *userContext, KCCallbackUPP userUPP)
OSStatus KCGetKeychain(KCItemRef item, KCRef *keychain)
OSStatus KCGetData(KCItemRef item, UInt32 maxLength, void *data, UInt32 *actualLength)
OSStatus KCGetAttribute(KCItemRef item, KCAttribute *attr, UInt32 *actualLength)
void DisposeKCCallbackUPP(KCCallbackUPP userUPP)
OSStatus kcaddgenericpassword(const char *serviceName, const char *accountName, UInt32 passwordLength, const void *passwordData, KCItemRef *item)
OSStatus kcgetkeychainname(KCRef keychain, char *keychainName)
OSStatus KCSetData(KCItemRef item, UInt32 length, const void *data)
OSStatus KCFindInternetPasswordWithPath(StringPtr serverName, StringPtr securityDomain, StringPtr accountName, StringPtr path, UInt16 port, OSType protocol, OSType authType, UInt32 maxLength, void *passwordData, UInt32 *actualLength, KCItemRef *item)
OSStatus KCGetKeychainName(KCRef keychain, StringPtr keychainName)
OSStatus KCMakeKCRefFromAlias(AliasHandle keychainAlias, KCRef *keychain)
OSStatus KCAddAppleSharePassword(AFPServerSignature *serverSignature, StringPtr serverAddress, StringPtr serverName, StringPtr volumeName, StringPtr accountName, UInt32 passwordLength, const void *passwordData, KCItemRef *item)
OSStatus KCSetInteractionAllowed(Boolean state)
OSStatus KCGetDefaultKeychain(KCRef *keychain)
OSStatus KCNewItem(KCItemClass itemClass, OSType itemCreator, UInt32 length, const void *data, KCItemRef *item)
OSStatus kcaddinternetpassword(const char *serverName, const char *securityDomain, const char *accountName, UInt16 port, OSType protocol, OSType authType, UInt32 passwordLength, const void *passwordData, KCItemRef *item)
OSStatus kcaddapplesharepassword(AFPServerSignature *serverSignature, const char *serverAddress, const char *serverName, const char *volumeName, const char *accountName, UInt32 passwordLength, const void *passwordData, KCItemRef *item)
UInt16 KCCountKeychains(void)
@ kAddKCEvent
Definition: KeychainCore.h:108
@ kDefaultChangedKCEvent
Definition: KeychainCore.h:113
@ kDeleteKCEvent
Definition: KeychainCore.h:109
@ kPasswordChangedKCEvent
Definition: KeychainCore.h:111
@ kLockKCEvent
Definition: KeychainCore.h:106
@ kUpdateKCEvent
Definition: KeychainCore.h:110
@ kKeychainListChangedKCEvent
Definition: KeychainCore.h:115
@ kSystemKCEvent
Definition: KeychainCore.h:112
@ kUnlockKCEvent
Definition: KeychainCore.h:107
@ kDataAccessKCEvent
Definition: KeychainCore.h:114
OSStatus KCReleaseSearch(KCSearchRef *search)
OSStatus KCSetDefaultKeychain(KCRef keychain)
OSStatus KCReleaseKeychain(KCRef *keychain)
OSStatus KCUpdateItem(KCItemRef item)
OSStatus KCDeleteItem(KCItemRef item)
OSStatus KCFindGenericPassword(StringPtr serviceName, StringPtr accountName, UInt32 maxLength, void *passwordData, UInt32 *actualLength, KCItemRef *item)
OSStatus KCAddCallback(KCCallbackUPP callbackProc, KCEventMask eventMask, void *userContext)
OSStatus KCAddInternetPassword(StringPtr serverName, StringPtr securityDomain, StringPtr accountName, UInt16 port, OSType protocol, OSType authType, UInt32 passwordLength, const void *passwordData, KCItemRef *item)
Boolean KCIsInteractionAllowed(void)
OSStatus KCRemoveCallback(KCCallbackUPP callbackProc)
Basic Macintosh data types.
unsigned char * StringPtr
Definition: MacTypes.h:477
unsigned char Boolean
Definition: MacTypes.h:318
void DisposeRoutineDescriptor(UniversalProcPtr theUPP)
#define STACK_UPP_TYPE(name)
Definition: MixedMode.h:734
UniversalProcPtr NewRoutineDescriptor(ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA)
Process Manager Interfaces.
Definition: KeychainCore.h:137
Definition: PPCToolbox.h:168
Definition: Processes.h:65
Definition: KeychainCore.h:88
SecKeychainAttribute * attr
Definition: KeychainCore.h:90
Definition: KeychainCore.h:80
void * data
Definition: KeychainCore.h:83
UInt32 length
Definition: KeychainCore.h:82