2 * Copyright (c) 2016 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
23 * SecCertificateSource.h - certificate sources for trust evaluation engine
27 #ifndef _SECURITY_SECCERTIFICATESOURCE_H_
28 #define _SECURITY_SECCERTIFICATESOURCE_H_
30 #include <CoreFoundation/CoreFoundation.h>
31 #include <Security/SecCertificate.h>
33 /********************************************************
34 ************ SecCertificateSource object ***************
35 ********************************************************/
36 typedef struct SecCertificateSource
*SecCertificateSourceRef
;
38 typedef void(*SecCertificateSourceParents
)(void *, CFArrayRef
);
40 typedef bool(*CopyParents
)(SecCertificateSourceRef source
,
41 SecCertificateRef certificate
,
42 void *context
, SecCertificateSourceParents
);
44 typedef CFArrayRef(*CopyConstraints
)(SecCertificateSourceRef source
,
45 SecCertificateRef certificate
);
47 typedef bool(*Contains
)(SecCertificateSourceRef source
,
48 SecCertificateRef certificate
);
50 struct SecCertificateSource
{
51 CopyParents copyParents
;
52 CopyConstraints copyUsageConstraints
;
56 bool SecCertificateSourceCopyParents(SecCertificateSourceRef source
,
57 SecCertificateRef certificate
,
58 void *context
, SecCertificateSourceParents callback
);
60 CFArrayRef
SecCertificateSourceCopyUsageConstraints(SecCertificateSourceRef source
,
61 SecCertificateRef certificate
);
63 bool SecCertificateSourceContains(SecCertificateSourceRef source
,
64 SecCertificateRef certificate
);
66 /********************************************************
67 ********************** Sources *************************
68 ********************************************************/
70 /* SecItemCertificateSource */
71 SecCertificateSourceRef
SecItemCertificateSourceCreate(CFArrayRef accessGroups
);
72 void SecItemCertificateSourceDestroy(SecCertificateSourceRef source
);
74 /* SecMemoryCertificateSource*/
75 SecCertificateSourceRef
SecMemoryCertificateSourceCreate(CFArrayRef certificates
);
76 void SecMemoryCertificateSourceDestroy(SecCertificateSourceRef source
);
78 /* SecSystemAnchorSource */
79 extern const SecCertificateSourceRef kSecSystemAnchorSource
;
82 /* SecUserAnchorSource */
83 extern const SecCertificateSourceRef kSecUserAnchorSource
;
86 /* SecCAIssuerCertificateSource */
87 extern const SecCertificateSourceRef kSecCAIssuerSource
;
90 /* SecLegacyCertificateSource */
91 extern const SecCertificateSourceRef kSecLegacyCertificateSource
;
93 /* SecLegacyAnchorSource */
94 extern const SecCertificateSourceRef kSecLegacyAnchorSource
;
97 #endif /* _SECURITY_SECCERTIFICATESOURCE_H_ */