securityd_client.h [plain text]
#ifndef _SECURITYD_CLIENT_H_
#define _SECURITYD_CLIENT_H_
#include <stdint.h>
#include <Security/SecTrustStore.h>
#include <CoreFoundation/CFArray.h>
#include <CoreFoundation/CFDictionary.h>
#if SECITEM_SHIM_OSX
#define SECURITYSERVER_BOOTSTRAP_NAME "com.apple.secd"
#else
#define SECURITYSERVER_BOOTSTRAP_NAME "com.apple.securityd"
#endif // *** END SECITEM_SHIM_OSX ***
#define SECURITYD(SPI, IN, OUT) (gSecurityd \
? gSecurityd->SPI(IN, OUT) \
: ServerCommandSendReceive(SPI ## _id, IN, OUT))
#define SECURITYD_AG(SPI, IN, OUT) (gSecurityd \
? gSecurityd->SPI(IN, OUT, SecAccessGroupsGetCurrent()) \
: ServerCommandSendReceive(SPI ## _id, IN, OUT))
enum {
sec_item_add_id,
sec_item_copy_matching_id,
sec_item_update_id,
sec_item_delete_id,
sec_trust_store_contains_id,
sec_trust_store_set_trust_settings_id,
sec_trust_store_remove_certificate_id,
sec_delete_all_id,
sec_trust_evaluate_id,
sec_restore_keychain_id,
sec_migrate_keychain_id,
sec_keychain_backup_id,
sec_keychain_restore_id
};
struct securityd {
OSStatus (*sec_item_add)(CFDictionaryRef attributes, CFTypeRef *result,
CFArrayRef accessGroups);
OSStatus (*sec_item_copy_matching)(CFDictionaryRef query,
CFTypeRef *result, CFArrayRef accessGroups);
OSStatus (*sec_item_update)(CFDictionaryRef query,
CFDictionaryRef attributesToUpdate, CFArrayRef accessGroups);
OSStatus (*sec_item_delete)(CFDictionaryRef query, CFArrayRef accessGroups);
SecTrustStoreRef (*sec_trust_store_for_domain)(CFStringRef domainName);
bool (*sec_trust_store_contains)(SecTrustStoreRef ts,
CFDataRef digest);
OSStatus (*sec_trust_store_set_trust_settings)(SecTrustStoreRef ts,
SecCertificateRef certificate, CFTypeRef trustSettingsDictOrArray);
OSStatus (*sec_trust_store_remove_certificate)(SecTrustStoreRef ts,
CFDataRef digest);
bool (*sec_truststore_remove_all)(SecTrustStoreRef ts);
bool (*sec_item_delete_all)(void);
OSStatus (*sec_trust_evaluate)(CFDictionaryRef args_in,
CFTypeRef *args_out);
OSStatus (*sec_restore_keychain)(void);
OSStatus (*sec_migrate_keychain)(CFArrayRef args_in, CFTypeRef *args_out);
OSStatus (*sec_keychain_backup)(CFArrayRef args_in, CFTypeRef *args_out);
OSStatus (*sec_keychain_restore)(CFArrayRef args_in, CFTypeRef *dummy);
};
extern struct securityd *gSecurityd;
CFArrayRef SecAccessGroupsGetCurrent(void);
void SecAccessGroupsSetCurrent(CFArrayRef accessGroups);
OSStatus ServerCommandSendReceive(uint32_t id, CFTypeRef in, CFTypeRef *out);
#endif