]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_keychain/lib/SecKeychainPriv.h
Security-58286.51.6.tar.gz
[apple/security.git] / OSX / libsecurity_keychain / lib / SecKeychainPriv.h
1 /*
2 * Copyright (c) 2003-2004,2011-2014 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifndef _SECURITY_SECKEYCHAINPRIV_H_
25 #define _SECURITY_SECKEYCHAINPRIV_H_
26
27 #include <Security/Security.h>
28 #include <Security/SecBasePriv.h>
29 #include <CoreFoundation/CoreFoundation.h>
30
31 #if defined(__cplusplus)
32 extern "C" {
33 #endif
34
35 enum {kSecKeychainEnteredBatchModeEvent = 14,
36 kSecKeychainLeftBatchModeEvent = 15};
37 enum {kSecKeychainEnteredBatchModeEventMask = 1 << kSecKeychainEnteredBatchModeEvent,
38 kSecKeychainLeftBatchModeEventMask = 1 << kSecKeychainLeftBatchModeEvent};
39
40
41 /* Keychain management */
42 OSStatus SecKeychainCreateNew(SecKeychainRef keychainRef, UInt32 passwordLength, const char* inPassword)
43 __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA);
44 OSStatus SecKeychainMakeFromFullPath(const char *fullPathName, SecKeychainRef *keychainRef)
45 __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA);
46 OSStatus SecKeychainIsValid(SecKeychainRef keychainRef, Boolean* isValid)
47 __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA);
48 OSStatus SecKeychainChangePassword(SecKeychainRef keychainRef, UInt32 oldPasswordLength, const void *oldPassword, UInt32 newPasswordLength, const void *newPassword)
49 __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA);
50 OSStatus SecKeychainOpenWithGuid(const CSSM_GUID *guid, uint32 subserviceId, uint32 subserviceType, const char* dbName, const CSSM_NET_ADDRESS *dbLocation, SecKeychainRef *keychain)
51 __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA);
52 OSStatus SecKeychainSetBatchMode (SecKeychainRef kcRef, Boolean mode, Boolean rollback)
53 __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
54
55 /* Keychain list management */
56 UInt16 SecKeychainListGetCount(void)
57 __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA);
58 OSStatus SecKeychainListCopyKeychainAtIndex(UInt16 index, SecKeychainRef *keychainRef)
59 __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA);
60 OSStatus SecKeychainListRemoveKeychain(SecKeychainRef *keychainRef)
61 __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA);
62 OSStatus SecKeychainRemoveFromSearchList(SecKeychainRef keychainRef)
63 __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA);
64
65 /* Login keychain support */
66 OSStatus SecKeychainLogin(UInt32 nameLength, const void* name, UInt32 passwordLength, const void* password)
67 __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA);
68 OSStatus SecKeychainStash()
69 __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_NA);
70 OSStatus SecKeychainLogout()
71 __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA);
72 OSStatus SecKeychainCopyLogin(SecKeychainRef *keychainRef)
73 __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA);
74 OSStatus SecKeychainResetLogin(UInt32 passwordLength, const void* password, Boolean resetSearchList)
75 __OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_NA);
76
77 OSStatus SecKeychainVerifyKeyStorePassphrase(uint32_t retries)
78 __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_NA);
79 OSStatus SecKeychainChangeKeyStorePassphrase()
80 __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_NA);
81
82 /* Keychain synchronization */
83 enum {
84 kSecKeychainNotSynchronized = 0,
85 kSecKeychainSynchronizedWithDotMac = 1
86 };
87 typedef UInt32 SecKeychainSyncState;
88
89 OSStatus SecKeychainCopySignature(SecKeychainRef keychainRef, CFDataRef *keychainSignature)
90 __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA);
91 OSStatus SecKeychainCopyBlob(SecKeychainRef keychainRef, CFDataRef *dbBlob)
92 __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA);
93 OSStatus SecKeychainRecodeKeychain(SecKeychainRef keychainRef, CFArrayRef dbBlobArray, CFDataRef extraData)
94 __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA);
95 OSStatus SecKeychainCreateWithBlob(const char* fullPathName, CFDataRef dbBlob, SecKeychainRef *kcRef)
96 __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA);
97
98 /* Keychain list manipulation */
99 OSStatus SecKeychainAddDBToKeychainList (SecPreferencesDomain domain, const char* dbName, const CSSM_GUID *guid, uint32 subServiceType)
100 __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA);
101 OSStatus SecKeychainDBIsInKeychainList (SecPreferencesDomain domain, const char* dbName, const CSSM_GUID *guid, uint32 subServiceType)
102 __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA);
103 OSStatus SecKeychainRemoveDBFromKeychainList (SecPreferencesDomain domain, const char* dbName, const CSSM_GUID *guid, uint32 subServiceType)
104 __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA);
105
106 /* server operation (keychain inhibit) */
107 void SecKeychainSetServerMode()
108 __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
109
110 /* special calls */
111 OSStatus SecKeychainCleanupHandles()
112 __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
113 OSStatus SecKeychainSystemKeychainCheckWouldDeadlock()
114 __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA);
115 OSStatus SecKeychainStoreUnlockKey(SecKeychainRef userKeychainRef, SecKeychainRef systemKeychainRef, CFStringRef username, CFStringRef password)
116 __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_NA);
117
118 /* Token login support */
119 OSStatus SecKeychainStoreUnlockKeyWithPubKeyHash(CFDataRef pubKeyHash, CFStringRef tokenID, CFDataRef wrapPubKeyHash, SecKeychainRef userKeychain, CFStringRef password)
120 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_NA);
121 OSStatus SecKeychainEraseUnlockKeyWithPubKeyHash(CFDataRef pubKeyHash)
122 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_NA);
123
124 /* calls to interact with keychain versions */
125 OSStatus SecKeychainGetKeychainVersion(SecKeychainRef keychain, UInt32* version)
126 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_NA);
127
128 OSStatus SecKeychainAttemptMigrationWithMasterKey(SecKeychainRef keychain, UInt32 version, const char* masterKeyFilename)
129 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_NA);
130
131 /* calls for testing only */
132 OSStatus SecKeychainGetUserPromptAttempts(uint32_t* attempts)
133 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_NA);
134
135 /*!
136 @function SecKeychainMDSInstall
137 Set up MDS.
138 */
139 OSStatus SecKeychainMDSInstall();
140
141 #if defined(__cplusplus)
142 }
143 #endif
144
145 #endif /* !_SECURITY_SECKEYCHAINPRIV_H_ */