2 * Copyright (c) 2007-2009 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@
26 The functions provided in SecPolicyPriv provide an interface to various
27 X.509 certificate trust policies.
30 #ifndef _SECURITY_SECPOLICYPRIV_H_
31 #define _SECURITY_SECPOLICYPRIV_H_
33 #include <Security/SecPolicy.h>
34 #include <CoreFoundation/CFArray.h>
35 #include <CoreFoundation/CFString.h>
37 #if defined(__cplusplus)
42 @function SecPolicyCreateiPhoneActivation
43 @abstract Returns a policy object for verifying iPhone Activation
45 @discussion This policy is like the Basic X.509 policy with the additional
46 requirements that the chain must contain exactly three certificates, the
47 anchor is the Apple Inc. CA, and the subject of the first intermediate
48 certificate has "Apple iPhone Certification Authority" as its only
50 @result A policy object. The caller is responsible for calling CFRelease
51 on this when it is no longer needed.
53 SecPolicyRef
SecPolicyCreateiPhoneActivation(void);
56 @function SecPolicyCreateiPhoneDeviceCertificate
57 @abstract Returns a policy object for verifying iPhone Device certificate
59 @discussion This policy is like the Basic X.509 policy with the additional
60 requirements that the chain must contain exactly four certificates, the
61 anchor is the Apple Inc. CA, and the subject of the first intermediate
62 certificate has "Apple iPhone Device CA" as its only Common Name entry.
63 @result A policy object. The caller is responsible for calling CFRelease
64 on this when it is no longer needed.
66 SecPolicyRef
SecPolicyCreateiPhoneDeviceCertificate(void);
69 @function SecPolicyCreateFactoryDeviceCertificate
70 @abstract Returns a policy object for verifying Factory Device certificate
72 @discussion This policy is like the Basic X.509 policy with the additional
73 requirements that the chain must be anchored to the factory device certificate
75 @result A policy object. The caller is responsible for calling CFRelease
76 on this when it is no longer needed.
78 SecPolicyRef
SecPolicyCreateFactoryDeviceCertificate(void);
81 @function SecPolicyCreateiAP
82 @abstract Returns a policy object for verifying iAP certificate chains.
83 @discussion This policy is like the Basic X.509 policy with these
84 additional requirements:
85 * The leaf's NotValidBefore should be greater than 5/31/06 midnight GMT.
86 * The Common Name of the leaf begins with the characters "IPA_".
87 * No validity checking is performed for any of the certificates.
88 The intended use of this policy is that the caller pass in the
89 intermediates for iAP1 and iAP2 to SecTrustSetAnchorCertificates().
90 @result A policy object. The caller is responsible for calling CFRelease
91 on this when it is no longer needed.
93 SecPolicyRef
SecPolicyCreateiAP(void);
96 @function SecPolicyCreateiTunesStoreURLBag
97 @abstract Returns a policy object for verifying iTunes Store URL bag
99 @discussion This policy is like the Basic X.509 policy with these
100 additional requirements:
101 * The leaf's Organization is Apple Inc.
102 * The Common Name of the leaf is "iTunes Store URL Bag".
103 @result A policy object. The caller is responsible for calling CFRelease
104 on this when it is no longer needed.
106 SecPolicyRef
SecPolicyCreateiTunesStoreURLBag(void);
109 @function SecPolicyCreateEAP
110 @abstract Returns a policy object for verifying for 802.1x/EAP certificates.
111 @param server Passing true for this parameter create a policy for EAP
113 @param trustedServerNames Optional; if present, the hostname in the leaf
114 certificate must be in the trustedServerNames list. Note that contrary
115 to all other policies the trustedServerNames list entries can have wildcards
116 whilst the certificate cannot. This matches the existing deployments.
117 @result A policy object. The caller is responsible for calling CFRelease
118 on this when it is no longer needed.
120 SecPolicyRef
SecPolicyCreateEAP(Boolean server
, CFArrayRef trustedServerNames
);
123 @function SecPolicyCreateIPSec
124 @abstract Returns a policy object for evaluating IPSec certificate chains.
125 @param server Passing true for this parameter create a policy for IPSec
127 @param hostname Optional; if present, the policy will require the specified
128 hostname or ip address to match the hostname in the leaf certificate.
129 @result A policy object. The caller is responsible for calling CFRelease
130 on this when it is no longer needed.
132 SecPolicyRef
SecPolicyCreateIPSec(Boolean server
, CFStringRef hostname
);
135 @function SecPolicyCreateiPhoneApplicationSigning
136 @abstract Returns a policy object for evaluating signed application
137 signatures. This is for apps signed directly by the app store.
138 @result A policy object. The caller is responsible for calling CFRelease
139 on this when it is no longer needed.
141 SecPolicyRef
SecPolicyCreateiPhoneApplicationSigning(void);
144 @function SecPolicyCreateiPhoneProfileApplicationSigning
145 @abstract Returns a policy object for evaluating signed application
146 signatures. This is meant for certificates inside a UPP or regular
147 profile. Currently it only checks for experation of the leaf and
149 @result A policy object. The caller is responsible for calling CFRelease
150 on this when it is no longer needed.
152 SecPolicyRef
SecPolicyCreateiPhoneProfileApplicationSigning(void);
155 @function SecPolicyCreateiPhoneProvisioningProfileSigning
156 @abstract Returns a policy object for evaluating provisioning profile signatures.
157 @result A policy object. The caller is responsible for calling CFRelease
158 on this when it is no longer needed.
160 SecPolicyRef
SecPolicyCreateiPhoneProvisioningProfileSigning(void);
163 @function SecPolicyCreateOCSPSigner
164 @abstract Returns a policy object for evaluating ocsp response signers.
165 @result A policy object. The caller is responsible for calling CFRelease
166 on this when it is no longer needed.
168 SecPolicyRef
SecPolicyCreateOCSPSigner(void);
171 @function SecPolicyCreateRevocation
172 @abstract Returns a policy object for checking revocation of certificates.
173 @result A policy object. The caller is responsible for calling CFRelease
174 on this when it is no longer needed.
176 SecPolicyRef
SecPolicyCreateRevocation(void);
179 kSecSignSMIMEUsage
= (1 << 0),
180 kSecKeyEncryptSMIMEUsage
= (1 << 1),
181 kSecDataEncryptSMIMEUsage
= (1 << 2),
182 kSecKeyExchangeDecryptSMIMEUsage
= (1 << 3),
183 kSecKeyExchangeEncryptSMIMEUsage
= (1 << 4),
184 kSecKeyExchangeBothSMIMEUsage
= (1 << 5),
185 kSecAnyEncryptSMIME
= kSecKeyEncryptSMIMEUsage
| kSecDataEncryptSMIMEUsage
|
186 kSecKeyExchangeDecryptSMIMEUsage
| kSecKeyExchangeEncryptSMIMEUsage
190 @function SecPolicyCreateSMIME
191 @abstract Returns a policy object for evaluating S/MIME certificate chains.
192 @param smimeUsage Pass the bitwise or of one or more kSecXXXSMIMEUsage
193 flags, to indicated the intended usage of this certificate. A certificate which allows
194 @param email Optional; if present, the policy will require the specified
195 email to match the email in the leaf certificate.
196 @result A policy object. The caller is responsible for calling CFRelease
197 on this when it is no longer needed.
199 SecPolicyRef
SecPolicyCreateSMIME(CFIndex smimeUsage
, CFStringRef email
);
202 @function SecPolicyCreateCodeSigning
203 @abstract Returns a policy object for evaluating code signing certificate chains.
204 @result A policy object. The caller is responsible for calling CFRelease
205 on this when it is no longer needed.
207 SecPolicyRef
SecPolicyCreateCodeSigning(void);
210 @function SecPolicyCreateLockdownPairing
211 @abstract basic x509 policy for checking lockdown pairing certificate chains.
212 It explicitly allows for empty subjects
214 SecPolicyRef
SecPolicyCreateLockdownPairing(void);
217 @function SecPolicyCreateURLBag
218 @abstract check for private CA, eku codesigning and certificate policy that
219 pertains to signing of URL bags.
221 SecPolicyRef
SecPolicyCreateURLBag(void);
224 @function SecPolicyCreateOTATasking
225 @abstract check for 3 long chain through Apple Certification Policy with common name
228 SecPolicyRef
SecPolicyCreateOTATasking(void);
231 @function SecPolicyCreateMobileAsset
232 @abstract check for 3 long chain through Apple Certification Policy with common name
233 "Asset Manifest Signing".
235 SecPolicyRef
SecPolicyCreateMobileAsset(void);
238 @function SecPolicyCreateAppleIDAuthorityPolicy
239 @abstract check for an Apple ID identity per marker in the leaf and marker in the intermediate, rooted in the Apple CA.
241 SecPolicyRef
SecPolicyCreateAppleIDAuthorityPolicy(void);
243 #if defined(__cplusplus)
247 #endif /* !_SECURITY_SECPOLICYPRIV_H_ */