]> git.saurik.com Git - apple/security.git/blob - trust/trustd/SecCertificateSource.h
Security-59754.41.1.tar.gz
[apple/security.git] / trust / trustd / SecCertificateSource.h
1 /*
2 * Copyright (c) 2016 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 * SecCertificateSource.h - certificate sources for trust evaluation engine
24 *
25 */
26
27 #ifndef _SECURITY_SECCERTIFICATESOURCE_H_
28 #define _SECURITY_SECCERTIFICATESOURCE_H_
29
30 #include <CoreFoundation/CoreFoundation.h>
31 #include <Security/SecCertificate.h>
32
33 /********************************************************
34 ************ SecCertificateSource object ***************
35 ********************************************************/
36 typedef struct SecCertificateSource *SecCertificateSourceRef;
37
38 typedef void(*SecCertificateSourceParents)(void *, CFArrayRef);
39
40 typedef bool(*CopyParents)(SecCertificateSourceRef source,
41 SecCertificateRef certificate,
42 void *context, SecCertificateSourceParents);
43
44 typedef CFArrayRef(*CopyConstraints)(SecCertificateSourceRef source,
45 SecCertificateRef certificate);
46
47 typedef bool(*Contains)(SecCertificateSourceRef source,
48 SecCertificateRef certificate);
49
50 struct SecCertificateSource {
51 CopyParents copyParents;
52 CopyConstraints copyUsageConstraints;
53 Contains contains;
54 };
55
56 bool SecCertificateSourceCopyParents(SecCertificateSourceRef source,
57 SecCertificateRef certificate,
58 void *context, SecCertificateSourceParents callback);
59
60 CFArrayRef SecCertificateSourceCopyUsageConstraints(SecCertificateSourceRef source,
61 SecCertificateRef certificate);
62
63 bool SecCertificateSourceContains(SecCertificateSourceRef source,
64 SecCertificateRef certificate);
65
66 /********************************************************
67 ********************** Sources *************************
68 ********************************************************/
69
70 /* SecItemCertificateSource */
71 SecCertificateSourceRef SecItemCertificateSourceCreate(CFArrayRef accessGroups);
72 void SecItemCertificateSourceDestroy(SecCertificateSourceRef source);
73
74 /* SecMemoryCertificateSource*/
75 SecCertificateSourceRef SecMemoryCertificateSourceCreate(CFArrayRef certificates);
76 void SecMemoryCertificateSourceDestroy(SecCertificateSourceRef source);
77
78 /* SecSystemAnchorSource */
79 extern const SecCertificateSourceRef kSecSystemAnchorSource;
80
81 /* SecUserAnchorSource */
82 extern const SecCertificateSourceRef kSecUserAnchorSource;
83
84 /* SecCAIssuerCertificateSource */
85 extern const SecCertificateSourceRef kSecCAIssuerSource;
86
87 #if TARGET_OS_OSX
88 /* SecLegacyCertificateSource */
89 extern const SecCertificateSourceRef kSecLegacyCertificateSource;
90
91 /* SecLegacyAnchorSource */
92 extern const SecCertificateSourceRef kSecLegacyAnchorSource;
93 #endif
94
95 #endif /* _SECURITY_SECCERTIFICATESOURCE_H_ */