]> git.saurik.com Git - apple/security.git/blob - sec/securityd/SecItemServer.h
Security-55471.14.8.tar.gz
[apple/security.git] / sec / securityd / SecItemServer.h
1 /*
2 * Copyright (c) 2007-2009,2012 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 /*!
25 @header SecItemServer
26 The functions provided in SecItemServer.h provide an interface to
27 the backed for SecItem APIs in the server.
28 */
29
30 #ifndef _SECURITYD_SECITEMSERVER_H_
31 #define _SECURITYD_SECITEMSERVER_H_
32
33 #include <CoreFoundation/CoreFoundation.h>
34 #include <SecureObjectSync/SOSEngine.h>
35 #include <SecureObjectSync/SOSCircle.h>
36 #include <utilities/SecDb.h>
37
38 __BEGIN_DECLS
39
40 bool _SecItemAdd(CFDictionaryRef attributes, CFArrayRef accessGroups, CFTypeRef *result, CFErrorRef *error);
41 bool _SecItemCopyMatching(CFDictionaryRef query, CFArrayRef accessGroups, CFTypeRef *result, CFErrorRef *error);
42 bool _SecItemUpdate(CFDictionaryRef query, CFDictionaryRef attributesToUpdate, CFArrayRef accessGroups, CFErrorRef *error);
43 bool _SecItemDelete(CFDictionaryRef query, CFArrayRef accessGroups, CFErrorRef *error);
44 bool _SecItemDeleteAll(CFErrorRef *error);
45 bool _SecServerRestoreKeychain(CFErrorRef *error);
46 bool _SecServerMigrateKeychain(int32_t handle_in, CFDataRef data_in, int32_t *handle_out, CFDataRef *data_out, CFErrorRef *error);
47 CFDataRef _SecServerKeychainBackup(CFDataRef keybag, CFDataRef passcode, CFErrorRef *error);
48 bool _SecServerKeychainRestore(CFDataRef backup, CFDataRef keybag, CFDataRef passcode, CFErrorRef *error);
49 bool _SecServerKeychainSyncUpdate(CFDictionaryRef updates, CFErrorRef *error);
50 CFDictionaryRef _SecServerBackupSyncable(CFDictionaryRef backup, CFDataRef keybag, CFDataRef password, CFErrorRef *error);
51 bool _SecServerRestoreSyncable(CFDictionaryRef backup, CFDataRef keybag, CFDataRef password, CFErrorRef *error);
52
53 // Hack to log objects from inside SOS code
54 void SecItemServerAppendItemDescription(CFMutableStringRef desc, CFDictionaryRef object);
55
56 // These are visible for testing.
57 SOSDataSourceFactoryRef SecItemDataSourceFactoryCreate(SecDbRef db);
58 SOSDataSourceFactoryRef SecItemDataSourceFactoryCreateDefault(void);
59
60 /* FIXME: there is a specific type for keybag handle (keybag_handle_t)
61 but it's not defined for simulator so we just use an int32_t */
62 void SecItemServerSetKeychainKeybag(int32_t keybag);
63 void SecItemServerResetKeychainKeybag(void);
64
65 void SecItemServerSetKeychainChangedNotification(const char *notification_name);
66
67 CFStringRef __SecKeychainCopyPath(void);
68
69 __END_DECLS
70
71 #endif /* _SECURITYD_SECITEMSERVER_H_ */