]> git.saurik.com Git - apple/security.git/blob - sec/ipc/securityd_client.h
Security-55163.44.tar.gz
[apple/security.git] / sec / ipc / securityd_client.h
1 /*
2 * Copyright (c) 2007-2009 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 #ifndef _SECURITYD_CLIENT_H_
24 #define _SECURITYD_CLIENT_H_
25
26 #include <stdint.h>
27 #include <Security/SecTrustStore.h>
28 #include <CoreFoundation/CFArray.h>
29 #include <CoreFoundation/CFDictionary.h>
30
31 #if SECITEM_SHIM_OSX
32 #define SECURITYSERVER_BOOTSTRAP_NAME "com.apple.secd"
33 #else
34 #define SECURITYSERVER_BOOTSTRAP_NAME "com.apple.securityd"
35 #endif // *** END SECITEM_SHIM_OSX ***
36
37 #define SECURITYD(SPI, IN, OUT) (gSecurityd \
38 ? gSecurityd->SPI(IN, OUT) \
39 : ServerCommandSendReceive(SPI ## _id, IN, OUT))
40
41 #define SECURITYD_AG(SPI, IN, OUT) (gSecurityd \
42 ? gSecurityd->SPI(IN, OUT, SecAccessGroupsGetCurrent()) \
43 : ServerCommandSendReceive(SPI ## _id, IN, OUT))
44
45 enum {
46 sec_item_add_id,
47 sec_item_copy_matching_id,
48 sec_item_update_id,
49 sec_item_delete_id,
50 sec_trust_store_contains_id,
51 sec_trust_store_set_trust_settings_id,
52 sec_trust_store_remove_certificate_id,
53 sec_delete_all_id,
54 sec_trust_evaluate_id,
55 sec_restore_keychain_id,
56 sec_migrate_keychain_id,
57 sec_keychain_backup_id,
58 sec_keychain_restore_id
59 };
60
61 struct securityd {
62 OSStatus (*sec_item_add)(CFDictionaryRef attributes, CFTypeRef *result,
63 CFArrayRef accessGroups);
64 OSStatus (*sec_item_copy_matching)(CFDictionaryRef query,
65 CFTypeRef *result, CFArrayRef accessGroups);
66 OSStatus (*sec_item_update)(CFDictionaryRef query,
67 CFDictionaryRef attributesToUpdate, CFArrayRef accessGroups);
68 OSStatus (*sec_item_delete)(CFDictionaryRef query, CFArrayRef accessGroups);
69 SecTrustStoreRef (*sec_trust_store_for_domain)(CFStringRef domainName);
70 bool (*sec_trust_store_contains)(SecTrustStoreRef ts,
71 CFDataRef digest);
72 OSStatus (*sec_trust_store_set_trust_settings)(SecTrustStoreRef ts,
73 SecCertificateRef certificate, CFTypeRef trustSettingsDictOrArray);
74 OSStatus (*sec_trust_store_remove_certificate)(SecTrustStoreRef ts,
75 CFDataRef digest);
76 bool (*sec_truststore_remove_all)(SecTrustStoreRef ts);
77 bool (*sec_item_delete_all)(void);
78 OSStatus (*sec_trust_evaluate)(CFDictionaryRef args_in,
79 CFTypeRef *args_out);
80 OSStatus (*sec_restore_keychain)(void);
81 OSStatus (*sec_migrate_keychain)(CFArrayRef args_in, CFTypeRef *args_out);
82 OSStatus (*sec_keychain_backup)(CFArrayRef args_in, CFTypeRef *args_out);
83 OSStatus (*sec_keychain_restore)(CFArrayRef args_in, CFTypeRef *dummy);
84 };
85
86 extern struct securityd *gSecurityd;
87
88 CFArrayRef SecAccessGroupsGetCurrent(void);
89 void SecAccessGroupsSetCurrent(CFArrayRef accessGroups);
90
91 OSStatus ServerCommandSendReceive(uint32_t id, CFTypeRef in, CFTypeRef *out);
92
93 #endif /* _SECURITYD_CLIENT_H_ */