]> git.saurik.com Git - apple/security.git/blob - trust/SecPolicyPriv.h
Security-57740.51.3.tar.gz
[apple/security.git] / trust / SecPolicyPriv.h
1 /*
2 * Copyright (c) 2003-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
24 /*!
25 @header SecPolicyPriv
26 The functions provided in SecPolicyPriv provide an interface to various
27 X.509 certificate trust policies.
28 */
29
30 #ifndef _SECURITY_SECPOLICYPRIV_H_
31 #define _SECURITY_SECPOLICYPRIV_H_
32
33 #include <Security/SecBase.h>
34 #include <Security/SecPolicy.h>
35 #include <Security/SecCertificate.h>
36 #include <CoreFoundation/CFArray.h>
37 #include <CoreFoundation/CFString.h>
38 #include <Availability.h>
39
40 __BEGIN_DECLS
41
42 CF_ASSUME_NONNULL_BEGIN
43 CF_IMPLICIT_BRIDGING_ENABLED
44
45 /*!
46 @enum Policy Constants (Private)
47 @discussion Predefined constants used to specify a policy.
48 @constant kSecPolicyAppleMobileStore
49 @constant kSecPolicyAppleTestMobileStore
50 @constant kSecPolicyAppleEscrowService
51 @constant kSecPolicyAppleProfileSigner
52 @constant kSecPolicyAppleQAProfileSigner
53 @constant kSecPolicyAppleServerAuthentication
54 @constant kSecPolicyAppleOTAPKISigner
55 @constant kSecPolicyAppleTestOTAPKISigner
56 @constant kSecPolicyAppleIDValidationRecordSigning
57 @constant kSecPolicyAppleSMPEncryption
58 @constant kSecPolicyAppleTestSMPEncryption
59 @constant kSecPolicyApplePCSEscrowService
60 @constant kSecPolicyApplePPQSigning
61 @constant kSecPolicyAppleTestPPQSigning
62 @constant kSecPolicyAppleSWUpdateSigning
63 @constant kSecPolicyApplePackageSigning
64 @constant kSecPolicyAppleOSXProvisioningProfileSigning
65 @constant kSecPolicyAppleATVVPNProfileSigning
66 @constant kSecPolicyAppleAST2DiagnosticsServerAuth
67 @constant kSecPolicyAppleEscrowProxyServerAuth
68 @constant kSecPolicyAppleFMiPServerAuth
69 @constant kSecPolicyAppleMMCService
70 @constant kSecPolicyAppleGSService
71 @constant kSecPolicyApplePPQService
72 @constant kSecPolicyAppleHomeKitServerAuth
73 @constant kSecPolicyAppleiPhoneActivation
74 @constant kSecPolicyAppleiPhoneDeviceCertificate
75 @constant kSecPolicyAppleFactoryDeviceCertificate
76 @constant kSecPolicyAppleiAP
77 @constant kSecPolicyAppleiTunesStoreURLBag
78 @constant kSecPolicyAppleiPhoneApplicationSigning
79 @constant kSecPolicyAppleiPhoneProfileApplicationSigning
80 @constant kSecPolicyAppleiPhoneProvisioningProfileSigning
81 @constant kSecPolicyAppleLockdownPairing
82 @constant kSecPolicyAppleURLBag
83 @constant kSecPolicyAppleOTATasking
84 @constant kSecPolicyAppleMobileAsset
85 @constant kSecPolicyAppleIDAuthority
86 @constant kSecPolicyAppleGenericApplePinned
87 @constant kSecPolicyAppleGenericAppleSSLPinned
88 @constant kSecPolicyAppleSoftwareSigning
89 @constant kSecPolicyAppleExternalDeveloper
90 @constant kSecPolicyAppleOCSPSigner
91 @constant kSecPolicyAppleIDSService
92 @constant kSecPolicyAppleIDSServiceContext
93 @constant kSecPolicyApplePushService
94 @constant kSecPolicyAppleLegacyPushService
95 @constant kSecPolicyAppleTVOSApplicationSigning
96 @constant kSecPolicyAppleUniqueDeviceIdentifierCertificate
97 @constant kSecPolicyAppleEscrowProxyCompatibilityServerAuth
98 @constant kSecPolicyAppleMMCSCompatibilityServerAuth
99 @constant kSecPolicyAppleSecureIOStaticAsset
100 @constant kSecPolicyAppleWarsaw
101 @constant kSecPolicyAppleiCloudSetupServerAuth
102 @constant kSecPolicyAppleiCloudSetupCompatibilityServerAuth
103 */
104 extern const CFStringRef kSecPolicyAppleMobileStore
105 __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
106 extern const CFStringRef kSecPolicyAppleTestMobileStore
107 __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
108 extern const CFStringRef kSecPolicyAppleEscrowService
109 __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
110 extern const CFStringRef kSecPolicyAppleProfileSigner
111 __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
112 extern const CFStringRef kSecPolicyAppleQAProfileSigner
113 __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
114 extern const CFStringRef kSecPolicyAppleServerAuthentication
115 __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
116 extern const CFStringRef kSecPolicyAppleOTAPKISigner
117 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_7_0);
118 extern const CFStringRef kSecPolicyAppleTestOTAPKISigner
119 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_7_0);
120 extern const CFStringRef kSecPolicyAppleIDValidationRecordSigningPolicy
121 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_7_0, __IPHONE_10_0);
122 extern const CFStringRef kSecPolicyAppleIDValidationRecordSigning
123 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
124 extern const CFStringRef kSecPolicyAppleSMPEncryption
125 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_8_0);
126 extern const CFStringRef kSecPolicyAppleTestSMPEncryption
127 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_8_0);
128 extern const CFStringRef kSecPolicyApplePCSEscrowService
129 __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_0);
130 extern const CFStringRef kSecPolicyApplePPQSigning
131 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
132 extern const CFStringRef kSecPolicyAppleTestPPQSigning
133 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
134 extern const CFStringRef kSecPolicyAppleSWUpdateSigning
135 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
136 extern const CFStringRef kSecPolicyApplePackageSigning
137 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
138 extern const CFStringRef kSecPolicyAppleOSXProvisioningProfileSigning
139 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
140 extern const CFStringRef kSecPolicyAppleATVVPNProfileSigning
141 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
142 extern const CFStringRef kSecPolicyAppleAST2DiagnosticsServerAuth
143 __OSX_AVAILABLE_STARTING(__MAC_10_11_4, __IPHONE_9_3);
144 extern const CFStringRef kSecPolicyAppleEscrowProxyServerAuth
145 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
146 extern const CFStringRef kSecPolicyAppleFMiPServerAuth
147 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
148 extern const CFStringRef kSecPolicyAppleMMCService
149 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
150 extern const CFStringRef kSecPolicyAppleGSService
151 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
152 extern const CFStringRef kSecPolicyApplePPQService
153 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
154 extern const CFStringRef kSecPolicyAppleHomeKitServerAuth
155 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
156 extern const CFStringRef kSecPolicyAppleiPhoneActivation
157 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
158 extern const CFStringRef kSecPolicyAppleiPhoneDeviceCertificate
159 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
160 extern const CFStringRef kSecPolicyAppleFactoryDeviceCertificate
161 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
162 extern const CFStringRef kSecPolicyAppleiAP
163 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
164 extern const CFStringRef kSecPolicyAppleiTunesStoreURLBag
165 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
166 extern const CFStringRef kSecPolicyAppleiPhoneApplicationSigning
167 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
168 extern const CFStringRef kSecPolicyAppleiPhoneProfileApplicationSigning
169 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
170 extern const CFStringRef kSecPolicyAppleiPhoneProvisioningProfileSigning
171 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
172 extern const CFStringRef kSecPolicyAppleLockdownPairing
173 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
174 extern const CFStringRef kSecPolicyAppleURLBag
175 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
176 extern const CFStringRef kSecPolicyAppleOTATasking
177 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
178 extern const CFStringRef kSecPolicyAppleMobileAsset
179 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
180 extern const CFStringRef kSecPolicyAppleIDAuthority
181 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
182 extern const CFStringRef kSecPolicyAppleGenericApplePinned
183 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
184 extern const CFStringRef kSecPolicyAppleGenericAppleSSLPinned
185 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
186 extern const CFStringRef kSecPolicyAppleSoftwareSigning
187 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
188 extern const CFStringRef kSecPolicyAppleExternalDeveloper
189 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
190 extern const CFStringRef kSecPolicyAppleOCSPSigner
191 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
192 extern const CFStringRef kSecPolicyAppleIDSService
193 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
194 extern const CFStringRef kSecPolicyAppleIDSServiceContext
195 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
196 extern const CFStringRef kSecPolicyApplePushService
197 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
198 extern const CFStringRef kSecPolicyAppleLegacyPushService
199 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
200 extern const CFStringRef kSecPolicyAppleTVOSApplicationSigning
201 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
202 extern const CFStringRef kSecPolicyAppleUniqueDeviceIdentifierCertificate
203 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
204 extern const CFStringRef kSecPolicyAppleEscrowProxyCompatibilityServerAuth
205 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
206 extern const CFStringRef kSecPolicyAppleMMCSCompatibilityServerAuth
207 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
208 extern const CFStringRef kSecPolicyAppleSecureIOStaticAsset
209 __OSX_AVAILABLE(10.12.1) __IOS_AVAILABLE(10.1) __TVOS_AVAILABLE(10.0.1) __WATCHOS_AVAILABLE(3.1);
210 extern const CFStringRef kSecPolicyAppleWarsaw
211 __OSX_AVAILABLE(10.12.1) __IOS_AVAILABLE(10.1) __TVOS_AVAILABLE(10.0.1) __WATCHOS_AVAILABLE(3.1);
212 extern const CFStringRef kSecPolicyAppleiCloudSetupServerAuth
213 __OSX_AVAILABLE(10.12.4) __IOS_AVAILABLE(10.3) __TVOS_AVAILABLE(10.2) __WATCHOS_AVAILABLE(3.2);
214 extern const CFStringRef kSecPolicyAppleiCloudSetupCompatibilityServerAuth
215 __OSX_AVAILABLE(10.12.4) __IOS_AVAILABLE(10.3) __TVOS_AVAILABLE(10.2) __WATCHOS_AVAILABLE(3.2);
216
217
218
219 /*!
220 @enum Policy Value Constants
221 @abstract Predefined property key constants used to get or set values in
222 a dictionary for a policy instance.
223 @discussion
224 All policies will have the following read-only value:
225 kSecPolicyOid (the policy object identifier)
226
227 Additional policy values which your code can optionally set:
228 kSecPolicyName (name which must be matched)
229 kSecPolicyClient (evaluate for client, rather than server)
230 kSecPolicyRevocationFlags (only valid for a revocation policy)
231 kSecPolicyRevocationFlags (only valid for a revocation policy)
232 kSecPolicyTeamIdentifier (only valid for a Passbook signing policy)
233 kSecPolicyContext (valid for policies below that take a context parameter)
234 kSecPolicyPolicyName (only valid for GenericApplePinned or
235 GenericAppleSSLPinned policies)
236 kSecPolicyIntermediateMarkerOid (only valid for GenericApplePinned or
237 GenericAppleSSLPinned policies)
238 kSecPolicyLeafMarkerOid (only valid for GenericApplePinned or
239 GenericAppleSSLPinned policies)
240 kSecPolicyRootDigest (only valid for the UniqueDeviceCertificate policy)
241
242 @constant kSecPolicyContext Specifies a CFDictionaryRef with keys and values
243 specified by the particular SecPolicyCreate function.
244 @constant kSecPolicyPolicyName Specifies a CFStringRef of the name of the
245 desired policy result.
246 @constant kSecPolicyIntermediateMarkerOid Specifies a CFStringRef of the
247 marker OID (in decimal format) required in the intermediate certificate.
248 @constant kSecPolicyLeafMarkerOid Specifies a CFStringRef of the
249 marker OID (in decimal format) required in the leaf certificate.
250 @constant kSecPolicyRootDigest Specifies a CFDataRef of digest required to
251 match the SHA-256 of the root certificate.
252 */
253 extern const CFStringRef kSecPolicyContext
254 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
255 extern const CFStringRef kSecPolicyPolicyName
256 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
257 extern const CFStringRef kSecPolicyIntermediateMarkerOid
258 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
259 extern const CFStringRef kSecPolicyLeafMarkerOid
260 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
261 extern const CFStringRef kSecPolicyRootDigest
262 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
263
264 /*!
265 @enum Revocation Policy Constants
266 @abstract Predefined constants which allow you to specify how revocation
267 checking will be performed for a trust evaluation.
268 @constant kSecRevocationOnlineCheck If this flag is set, perform an online
269 revocation check, ignoring cached revocation results. This flag will not force
270 an online check if an online check was done within the last 5 minutes. Online
271 checks are only applicable to OCSP; this constant will not force a fresh
272 CRL download.
273 */
274 extern const CFOptionFlags kSecRevocationOnlineCheck;
275
276 /*!
277 @function SecPolicyCreateApplePinned
278 @abstract Returns a policy object for verifying Apple certificates.
279 @param policyName A string that identifies the policy name.
280 @param intermediateMarkerOID A string containing the decimal representation of the
281 extension OID in the intermediate certificate.
282 @param leafMarkerOID A string containing the decimal representation of the extension OID
283 in the leaf certificate.
284 @discussion The resulting policy uses the Basic X.509 policy with validity check and
285 pinning options:
286 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
287 the chain to be anchored to Test Apple Root CAs if the value true is set for the key
288 "ApplePinningAllowTestCerts%@" (where %@ is the policyName parameter) in the
289 com.apple.security preferences for the user of the calling application.
290 * There are exactly 3 certs in the chain.
291 * The intermediate has a marker extension with OID matching the intermediateMarkerOID
292 parameter.
293 * The leaf has a marker extension with OID matching the leafMarkerOID parameter.
294 * Revocation is checked via any available method.
295 * RSA key sizes are 2048-bit or larger. EC key sizes are P-256 or larger.
296 @result A policy object. The caller is responsible for calling CFRelease on this when
297 it is no longer needed.
298 */
299 __nullable CF_RETURNS_RETAINED
300 SecPolicyRef SecPolicyCreateApplePinned(CFStringRef policyName,
301 CFStringRef intermediateMarkerOID, CFStringRef leafMarkerOID)
302 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
303
304 /*!
305 @function SecPolicyCreateAppleSSLPinned
306 @abstract Returns a policy object for verifying Apple SSL certificates.
307 @param policyName A string that identifies the service/policy name.
308 @param hostname hostname to verify the certificate name against.
309 @param intermediateMarkerOID A string containing the decimal representation of the
310 extension OID in the intermediate certificate. If NULL is passed, the default OID of
311 1.2.840.113635.100.6.2.12 is checked.
312 @param leafMarkerOID A string containing the decimal representation of the extension OID
313 in the leaf certificate.
314 @discussion The resulting policy uses the Basic X.509 policy with validity check and
315 pinning options:
316 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
317 the chain to be anchored to Test Apple Root CAs if the value true is set for the key
318 "ApplePinningAllowTestCerts%@" (where %@ is the policyName parameter) in the
319 com.apple.security preferences for the user of the calling application.
320 * There are exactly 3 certs in the chain.
321 * The intermediate has a marker extension with OID matching the intermediateMarkerOID
322 parameter, or 1.2.840.113635.100.6.2.12 if NULL is passed.
323 * The leaf has a marker extension with OID matching the leafMarkerOID parameter.
324 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
325 extension or Common Name.
326 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
327 * Revocation is checked via any available method.
328 * RSA key sizes are 2048-bit or larger. EC key sizes are P-256 or larger.
329 @result A policy object. The caller is responsible for calling CFRelease on this when
330 it is no longer needed.
331 */
332 __nullable CF_RETURNS_RETAINED
333 SecPolicyRef SecPolicyCreateAppleSSLPinned(CFStringRef policyName, CFStringRef hostname,
334 CFStringRef __nullable intermediateMarkerOID, CFStringRef leafMarkerOID)
335 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
336
337 /*!
338 @function SecPolicyCreateiPhoneActivation
339 @abstract Returns a policy object for verifying iPhone Activation
340 certificate chains.
341 @discussion This policy uses the Basic X.509 policy with no validity check
342 and pinning options:
343 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
344 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
345 * There are exactly 3 certs in chain.
346 * The intermediate has Common Name "Apple iPhone Certification Authority".
347 * The leaf has Common Name "iPhone Activation".
348 @result A policy object. The caller is responsible for calling CFRelease
349 on this when it is no longer needed.
350 */
351 __nullable CF_RETURNS_RETAINED
352 SecPolicyRef SecPolicyCreateiPhoneActivation(void);
353
354 /*!
355 @function SecPolicyCreateiPhoneDeviceCertificate
356 @abstract Returns a policy object for verifying iPhone Device certificate
357 chains.
358 @discussion This policy uses the Basic X.509 policy with no validity check
359 and pinning options:
360 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
361 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
362 * There are exactly 4 certs in chain.
363 * The first intermediate has Common Name "Apple iPhone Device CA".
364 @result A policy object. The caller is responsible for calling CFRelease
365 on this when it is no longer needed.
366 */
367 __nullable CF_RETURNS_RETAINED
368 SecPolicyRef SecPolicyCreateiPhoneDeviceCertificate(void);
369
370 /*!
371 @function SecPolicyCreateFactoryDeviceCertificate
372 @abstract Returns a policy object for verifying Factory Device certificate
373 chains.
374 @discussion This policy uses the Basic X.509 policy with no validity check
375 and pinning options:
376 * The chain is anchored to the Factory Device CA.
377 @result A policy object. The caller is responsible for calling CFRelease
378 on this when it is no longer needed.
379 */
380 __nullable CF_RETURNS_RETAINED
381 SecPolicyRef SecPolicyCreateFactoryDeviceCertificate(void);
382
383 /*!
384 @function SecPolicyCreateiAP
385 @abstract Returns a policy object for verifying iAP certificate chains.
386 @discussion This policy uses the Basic X.509 policy with no validity check
387 and pinning options:
388 * The leaf has notBefore date after 5/31/2006 midnight GMT.
389 * The leaf has Common Name beginning with "IPA_".
390 The intended use of this policy is that the caller pass in the
391 intermediates for iAP1 and iAP2 to SecTrustSetAnchorCertificates().
392 @result A policy object. The caller is responsible for calling CFRelease
393 on this when it is no longer needed.
394 */
395 __nullable CF_RETURNS_RETAINED
396 SecPolicyRef SecPolicyCreateiAP(void);
397
398 /*!
399 @function SecPolicyCreateiTunesStoreURLBag
400 @abstract Returns a policy object for verifying iTunes Store URL bag
401 certificates.
402 @discussion This policy uses the Basic X.509 policy with no validity check
403 and pinning options:
404 * The chain is anchored to the iTMS CA.
405 * There are exactly 2 certs in the chain.
406 * The leaf has Organization "Apple Inc.".
407 * The leaf has Common Name "iTunes Store URL Bag".
408 @result A policy object. The caller is responsible for calling CFRelease
409 on this when it is no longer needed.
410 */
411 __nullable CF_RETURNS_RETAINED
412 SecPolicyRef SecPolicyCreateiTunesStoreURLBag(void);
413
414 /*!
415 @function SecPolicyCreateEAP
416 @abstract Returns a policy object for verifying for 802.1x/EAP certificates.
417 @param server Passing true for this parameter create a policy for EAP
418 server certificates.
419 @param trustedServerNames Optional; if present, the hostname in the leaf
420 certificate must be in the trustedServerNames list. Note that contrary
421 to all other policies the trustedServerNames list entries can have wildcards
422 whilst the certificate cannot. This matches the existing deployments.
423 @discussion This policy uses the Basic X.509 policy with validity check but
424 disallowing network fetching. If trustedServerNames param is non-null, the
425 ExtendedKeyUsage extension, if present, of the leaf certificate is verified
426 to contain either the ServerAuth OID, if the server param is true or
427 ClientAuth OID, otherwise.
428 @result A policy object. The caller is responsible for calling CFRelease
429 on this when it is no longer needed.
430 */
431 __nullable CF_RETURNS_RETAINED
432 SecPolicyRef SecPolicyCreateEAP(Boolean server, CFArrayRef __nullable trustedServerNames);
433
434 /*!
435 @function SecPolicyCreateIPSec
436 @abstract Returns a policy object for evaluating IPSec certificate chains.
437 @param server Passing true for this parameter create a policy for IPSec
438 server certificates.
439 @param hostname Optional; if present, the policy will require the specified
440 hostname or ip address to match the hostname in the leaf certificate.
441 @discussion This policy uses the Basic X.509 policy with validity check.
442 @result A policy object. The caller is responsible for calling CFRelease
443 on this when it is no longer needed.
444 */
445 __nullable CF_RETURNS_RETAINED
446 SecPolicyRef SecPolicyCreateIPSec(Boolean server, CFStringRef __nullable hostname);
447
448 /*!
449 @function SecPolicyCreateAppleSWUpdateSigning
450 @abstract Returns a policy object for evaluating SW update signing certs.
451 @discussion This policy uses the Basic X.509 policy with no validity check
452 and pinning options:
453 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
454 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
455 * There are exactly 3 certs in the chain.
456 * The intermediate ExtendedKeyUsage Extension contains 1.2.840.113635.100.4.1.
457 * The leaf ExtendedKeyUsage extension contains 1.2.840.113635.100.4.1.
458 @result A policy object. The caller is responsible for calling CFRelease
459 on this when it is no longer needed.
460 */
461 __nullable CF_RETURNS_RETAINED
462 SecPolicyRef SecPolicyCreateAppleSWUpdateSigning(void);
463
464 /*!
465 @function SecPolicyCreateApplePackageSigning
466 @abstract Returns a policy object for evaluating installer package signing certs.
467 @discussion This policy uses the Basic X.509 policy with no validity check
468 and pinning options:
469 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
470 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
471 * There are exactly 3 certs in the chain.
472 * The leaf KeyUsage extension has the digital signature bit set.
473 * The leaf ExtendedKeyUsage extension has the CodeSigning OID.
474 @result A policy object. The caller is responsible for calling CFRelease
475 on this when it is no longer needed.
476 */
477 __nullable CF_RETURNS_RETAINED
478 SecPolicyRef SecPolicyCreateApplePackageSigning(void);
479
480 /*!
481 @function SecPolicyCreateiPhoneApplicationSigning
482 @abstract Returns a policy object for evaluating signed application
483 signatures. This is for apps signed directly by the app store.
484 @discussion This policy uses the Basic X.509 policy with no validity check
485 and pinning options:
486 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
487 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
488 * There are exactly 3 certs in the chain.
489 * The intermediate has Common Name "Apple iPhone Certification Authority".
490 * The leaf has Common Name "Apple iPhone OS Application Signing".
491 * The leaf has a marker extension with OID 1.2.840.113635.100.6.1.3 or OID
492 1.2.840.113635.100.6.1.6.
493 * The leaf has ExtendedKeyUsage, if any, with the AnyExtendedKeyUsage OID
494 or the CodeSigning OID.
495 @result A policy object. The caller is responsible for calling CFRelease
496 on this when it is no longer needed.
497 */
498 __nullable CF_RETURNS_RETAINED
499 SecPolicyRef SecPolicyCreateiPhoneApplicationSigning(void);
500
501 /*!
502 @function SecPolicyCreateiPhoneProfileApplicationSigning
503 @abstract Returns a policy object for evaluating signed application
504 signatures. This policy is for certificates inside a UPP or regular
505 profile.
506 @discussion This policy only verifies that the leaf is temporally valid
507 and not revoked via any available method.
508 @result A policy object. The caller is responsible for calling CFRelease
509 on this when it is no longer needed.
510 */
511 __nullable CF_RETURNS_RETAINED
512 SecPolicyRef SecPolicyCreateiPhoneProfileApplicationSigning(void);
513
514 /*!
515 @function SecPolicyCreateiPhoneProvisioningProfileSigning
516 @abstract Returns a policy object for evaluating provisioning profile signatures.
517 @discussion This policy uses the Basic X.509 policy with no validity check
518 and pinning options:
519 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
520 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
521 * There are exactly 3 certs in the chain.
522 * The intermediate has Common Name "Apple iPhone Certification Authority".
523 * The leaf has Common Name "Apple iPhone OS Provisioning Profile Signing".
524 * If the device is not a production device and is running an internal
525 release, the leaf may have the Common Name "TEST Apple iPhone OS
526 Provisioning Profile Signing TEST".
527 @result A policy object. The caller is responsible for calling CFRelease
528 on this when it is no longer needed.
529 */
530 __nullable CF_RETURNS_RETAINED
531 SecPolicyRef SecPolicyCreateiPhoneProvisioningProfileSigning(void);
532
533 /*!
534 @function SecPolicyCreateAppleTVOSApplicationSigning
535 @abstract Returns a policy object for evaluating signed application
536 signatures. This is for apps signed directly by the Apple TV app store,
537 and allows for both the prod and the dev/test certs.
538 @discussion This policy uses the Basic X.509 policy with no validity check
539 and pinning options:
540 * The chain is anchored to any of the production Apple Root CAs.
541 Test roots are never permitted.
542 * There are exactly 3 certs in the chain.
543 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.1.
544 * The leaf has ExtendedKeyUsage, if any, with the AnyExtendedKeyUsage OID or
545 the CodeSigning OID.
546 * The leaf has a marker extension with OID 1.2.840.113635.100.6.1.24 or OID
547 1.2.840.113635.100.6.1.24.1.
548 @result A policy object. The caller is responsible for calling CFRelease
549 on this when it is no longer needed.
550 */
551 __nullable CF_RETURNS_RETAINED
552 SecPolicyRef SecPolicyCreateAppleTVOSApplicationSigning(void);
553
554 /*!
555 @function SecPolicyCreateOCSPSigner
556 @abstract Returns a policy object for evaluating ocsp response signers.
557 @discussion This policy uses the Basic X.509 policy with validity check and
558 requires the leaf to have an ExtendedKeyUsage of OCSPSigning.
559 @result A policy object. The caller is responsible for calling CFRelease
560 on this when it is no longer needed.
561 */
562 __nullable CF_RETURNS_RETAINED
563 SecPolicyRef SecPolicyCreateOCSPSigner(void);
564
565
566 enum {
567 kSecSignSMIMEUsage = (1 << 0),
568 kSecKeyEncryptSMIMEUsage = (1 << 1),
569 kSecDataEncryptSMIMEUsage = (1 << 2),
570 kSecKeyExchangeDecryptSMIMEUsage = (1 << 3),
571 kSecKeyExchangeEncryptSMIMEUsage = (1 << 4),
572 kSecKeyExchangeBothSMIMEUsage = (1 << 5),
573 kSecAnyEncryptSMIME = kSecKeyEncryptSMIMEUsage | kSecDataEncryptSMIMEUsage |
574 kSecKeyExchangeDecryptSMIMEUsage | kSecKeyExchangeEncryptSMIMEUsage
575 };
576
577 /*!
578 @function SecPolicyCreateSMIME
579 @abstract Returns a policy object for evaluating S/MIME certificate chains.
580 @param smimeUsage Pass the bitwise or of one or more kSecXXXSMIMEUsage
581 flags, to indicate the intended usage of this certificate.
582 @param email Optional; if present, the policy will require the specified
583 email to match the email in the leaf certificate.
584 @discussion This policy uses the Basic X.509 policy with validity check and
585 requires the leaf to have
586 * a KeyUsage matching the smimeUsage,
587 * an ExtendedKeyUsage, if any, with the AnyExtendedKeyUsage OID or the
588 EmailProtection OID, and
589 * if the email param is specified, the email address in the RFC822Name in the
590 SubjectAlternativeName extension or in the Email Address field of the
591 Subject Name.
592 @result A policy object. The caller is responsible for calling CFRelease
593 on this when it is no longer needed.
594 */
595 __nullable CF_RETURNS_RETAINED
596 SecPolicyRef SecPolicyCreateSMIME(CFIndex smimeUsage, CFStringRef __nullable email);
597
598 /*!
599 @function SecPolicyCreateCodeSigning
600 @abstract Returns a policy object for evaluating code signing certificate chains.
601 @discussion This policy uses the Basic X.509 policy with validity check and
602 requires the leaf to have
603 * a KeyUsage with both the DigitalSignature and NonRepudiation bits set, and
604 * an ExtendedKeyUsage with the AnyExtendedKeyUsage OID or the CodeSigning OID.
605 @result A policy object. The caller is responsible for calling CFRelease
606 on this when it is no longer needed.
607 */
608 __nullable CF_RETURNS_RETAINED
609 SecPolicyRef SecPolicyCreateCodeSigning(void);
610
611 /*!
612 @function SecPolicyCreateLockdownPairing
613 @abstract basic x509 policy for checking lockdown pairing certificate chains.
614 @disucssion This policy checks some of the Basic X.509 policy options with no
615 validity check. It explicitly allows for empty subjects.
616 @result A policy object. The caller is responsible for calling CFRelease
617 on this when it is no longer needed.
618 */
619 __nullable CF_RETURNS_RETAINED
620 SecPolicyRef SecPolicyCreateLockdownPairing(void);
621
622 /*!
623 @function SecPolicyCreateURLBag
624 @abstract Returns a policy object for evaluating certificate chains for signing URL bags.
625 @discussion This policy uses the Basic X.509 policy with no validity check and requires
626 that the leaf has ExtendedKeyUsage extension with the CodeSigning OID.
627 @result A policy object. The caller is responsible for calling CFRelease
628 on this when it is no longer needed.
629 */
630 __nullable CF_RETURNS_RETAINED
631 SecPolicyRef SecPolicyCreateURLBag(void);
632
633 /*!
634 @function SecPolicyCreateOTATasking
635 @abstract Returns a policy object for evaluating certificate chains for signing OTA Tasking.
636 @discussion This policy uses the Basic X.509 policy with validity check and
637 pinning options:
638 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
639 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
640 * There are exactly 3 certs in the chain.
641 * The intermediate has Common Name "Apple iPhone Certification Authority".
642 * The leaf has Common Name "OTA Task Signing".
643 @result A policy object. The caller is responsible for calling CFRelease
644 on this when it is no longer needed.
645 */
646 __nullable CF_RETURNS_RETAINED
647 SecPolicyRef SecPolicyCreateOTATasking(void);
648
649 /*!
650 @function SecPolicyCreateMobileAsset
651 @abstract Returns a policy object for evaluating certificate chains for signing Mobile Assets.
652 @discussion This policy uses the Basic X.509 policy with no validity check
653 and pinning options:
654 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
655 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
656 * There are exactly 3 certs in the chain.
657 * The intermediate has Common Name "Apple iPhone Certification Authority".
658 * The leaf has Common Name "Asset Manifest Signing".
659 @result A policy object. The caller is responsible for calling CFRelease
660 on this when it is no longer needed.
661 */
662 __nullable CF_RETURNS_RETAINED
663 SecPolicyRef SecPolicyCreateMobileAsset(void);
664
665 /*!
666 @function SecPolicyCreateAppleIDAuthorityPolicy
667 @abstract Returns a policy object for evaluating certificate chains for Apple ID Authority.
668 @discussion This policy uses the Basic X.509 policy with validity check
669 and pinning options:
670 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
671 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
672 * The intermediate(s) has(have) a marker extension with OID 1.2.840.113635.100.6.2.3
673 or OID 1.2.840.113635.100.6.2.7.
674 * The leaf has a marker extension with OID 1.2.840.113635.100.4.7.
675 @result A policy object. The caller is responsible for calling CFRelease
676 on this when it is no longer needed.
677 */
678 __nullable CF_RETURNS_RETAINED
679 SecPolicyRef SecPolicyCreateAppleIDAuthorityPolicy(void);
680
681 /*!
682 @function SecPolicyCreateMacAppStoreReceipt
683 @abstract Returns a policy object for evaluating certificate chains for signing
684 Mac App Store Receipts.
685 @discussion This policy uses the Basic X.509 policy with validity check
686 and pinning options:
687 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
688 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
689 * There are exactly 3 certs in the chain.
690 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.1.
691 * The leaf has CertificatePolicy extension with OID 1.2.840.113635.100.5.6.1.
692 * The leaf has a marker extension with OID 1.2.840.113635.100.6.11.1.
693 * Revocation is checked via any available method.
694 @result A policy object. The caller is responsible for calling CFRelease
695 on this when it is no longer needed.
696 */
697 __nullable CF_RETURNS_RETAINED
698 SecPolicyRef SecPolicyCreateMacAppStoreReceipt(void);
699
700 /*!
701 @function SecPolicyCreatePassbookCardSigner
702 @abstract Returns a policy object for evaluating certificate chains for signing Passbook cards.
703 @param cardIssuer Required; must match name in marker extension.
704 @param teamIdentifier Optional; if present, the policy will require the specified
705 team ID to match the organizationalUnit field in the leaf certificate's subject.
706 @discussion This policy uses the Basic X.509 policy with validity check
707 and pinning options:
708 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
709 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
710 * The leaf has a marker extension with OID 1.2.840.113635.100.6.1.16 and containing the
711 cardIssuer.
712 * The leaf has ExtendedKeyUsage with OID 1.2.840.113635.100.4.14.
713 * The leaf has a Organizational Unit matching the TeamID.
714 @result A policy object. The caller is responsible for calling CFRelease
715 on this when it is no longer needed.
716 */
717 __nullable CF_RETURNS_RETAINED
718 SecPolicyRef SecPolicyCreatePassbookCardSigner(CFStringRef cardIssuer,
719 CFStringRef __nullable teamIdentifier);
720
721 /*!
722 @function SecPolicyCreateMobileStoreSigner
723 @abstract Returns a policy object for evaluating Mobile Store certificate chains.
724 @discussion This policy uses the Basic X.509 policy with validity check
725 and pinning options:
726 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
727 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
728 * There are exactly 3 certs in the chain.
729 * The intermediate has Common Name "Apple System Integration 2 Certification Authority".
730 * The leaf has KeyUsage with the DigitalSignature bit set.
731 * The leaf has CertificatePolicy extension with OID 1.2.840.113635.100.5.12.
732 @result A policy object. The caller is responsible for calling CFRelease
733 on this when it is no longer needed.
734 */
735 __nullable CF_RETURNS_RETAINED
736 SecPolicyRef SecPolicyCreateMobileStoreSigner(void);
737
738 /*!
739 @function SecPolicyCreateTestMobileStoreSigner
740 @abstract Returns a policy object for evaluating Test Mobile Store certificate chains.
741 @discussion This policy uses the Basic X.509 policy with validity check
742 and pinning options:
743 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
744 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
745 * There are exactly 3 certs in the chain.
746 * The intermediate has Common Name "Apple System Integration 2 Certification Authority".
747 * The leaf has KeyUsage with the DigitalSignature bit set.
748 * The leaf has CertificatePolicy extension with OID 1.2.840.113635.100.5.12.1.
749 @result A policy object. The caller is responsible for calling CFRelease
750 on this when it is no longer needed.
751 */
752 __nullable CF_RETURNS_RETAINED
753 SecPolicyRef SecPolicyCreateTestMobileStoreSigner(void);
754
755 /*!
756 @function SecPolicyCreateEscrowServiceSigner
757 @abstract Returns a policy object for evaluating Escrow Service certificate chains.
758 @discussion This policy uses the Basic X.509 policy with no validity check
759 and pinning options:
760 * The chain is anchored to the current Escrow Roots in the OTAPKI asset.
761 * There are exactly 2 certs in the chain.
762 * The leaf has KeyUsage with the KeyEncipherment bit set.
763 @result A policy object. The caller is responsible for calling CFRelease
764 on this when it is no longer needed.
765 */
766 __nullable CF_RETURNS_RETAINED
767 SecPolicyRef SecPolicyCreateEscrowServiceSigner(void);
768
769 /*!
770 @function SecPolicyCreatePCSEscrowServiceSigner
771 @abstract Returns a policy object for evaluating PCS Escrow Service certificate chains.
772 @discussion This policy uses the Basic X.509 policy with validity check
773 and pinning options:
774 * The chain is anchored to the current PCS Escrow Roots in the OTAPKI asset.
775 * There are exactly 2 certs in the chain.
776 * The leaf has KeyUsage with the KeyEncipherment bit set.
777 @result A policy object. The caller is responsible for calling CFRelease
778 on this when it is no longer needed.
779 */
780 __nullable CF_RETURNS_RETAINED
781 SecPolicyRef SecPolicyCreatePCSEscrowServiceSigner(void);
782
783 /*!
784 @function SecPolicyCreateOSXProvisioningProfileSigning
785 @abstract Returns a policy object for evaluating certificate chains for signing OS X
786 Provisioning Profiles.
787 @discussion This policy uses the Basic X.509 policy with validity check
788 and pinning options:
789 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
790 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
791 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.1.
792 * The leaf has KeyUsage with the DigitalSignature bit set.
793 * The leaf has a marker extension with OID 1.2.840.113635.100.4.11.
794 * Revocation is checked via OCSP.
795 @result A policy object. The caller is responsible for calling CFRelease
796 on this when it is no longer needed.
797 */
798 __nullable CF_RETURNS_RETAINED
799 SecPolicyRef SecPolicyCreateOSXProvisioningProfileSigning(void);
800
801 /*!
802 @function SecPolicyCreateConfigurationProfileSigner
803 @abstract Returns a policy object for evaluating certificate chains for signing
804 Configuration Profiles.
805 @discussion This policy uses the Basic X.509 policy with validity check
806 and pinning options:
807 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
808 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
809 * There are exactly 3 certs in the chain.
810 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.3.
811 * The leaf has ExtendedKeyUsage with OID 1.2.840.113635.100.4.16.
812 @result A policy object. The caller is responsible for calling CFRelease
813 on this when it is no longer needed.
814 */
815 __nullable CF_RETURNS_RETAINED
816 SecPolicyRef SecPolicyCreateConfigurationProfileSigner(void);
817
818 /*!
819 @function SecPolicyCreateQAConfigurationProfileSigner
820 @abstract Returns a policy object for evaluating certificate chains for signing
821 QA Configuration Profiles. On customer builds, this function returns the same
822 policy as SecPolicyCreateConfigurationProfileSigner.
823 @discussion This policy uses the Basic X.509 policy with validity check
824 and pinning options:
825 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
826 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
827 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.3.
828 * The leaf has ExtendedKeyUsage with OID 1.2.840.113635.100.4.17.
829 @result A policy object. The caller is responsible for calling CFRelease
830 on this when it is no longer needed.
831 */
832 __nullable CF_RETURNS_RETAINED
833 SecPolicyRef SecPolicyCreateQAConfigurationProfileSigner(void);
834
835 /*!
836 @function SecPolicyCreateOTAPKISigner
837 @abstract Returns a policy object for evaluating OTA PKI certificate chains.
838 @discussion This policy uses the Basic X.509 policy with validity check
839 and pinning options:
840 * The chain is anchored to Apple PKI Settings CA.
841 * There are exactly 2 certs in the chain.
842 @result A policy object. The caller is responsible for calling CFRelease
843 on this when it is no longer needed.
844 */
845 __nullable CF_RETURNS_RETAINED
846 SecPolicyRef SecPolicyCreateOTAPKISigner(void);
847
848 /*!
849 @function SecPolicyCreateTestOTAPKISigner
850 @abstract Returns a policy object for evaluating OTA PKI certificate chains.
851 @discussion This policy uses the Basic X.509 policy with validity check
852 and pinning options:
853 * The chain is anchored to Apple Test PKI Settings CA.
854 * There are exactly 2 certs in the chain.
855 @result A policy object. The caller is responsible for calling CFRelease
856 on this when it is no longer needed.
857 */
858 __nullable CF_RETURNS_RETAINED
859 SecPolicyRef SecPolicyCreateTestOTAPKISigner(void);
860
861 /*!
862 @function SecPolicyCreateAppleIDValidationRecordSigningPolicy
863 @abstract Returns a policy object for evaluating certificate chains for signing
864 Apple ID Validation Records.
865 @discussion This policy uses the Basic X.509 policy with validity check
866 and pinning options:
867 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
868 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
869 * The intermediate(s) has(have) a marker extension with OID 1.2.840.113635.100.6.2.3
870 or OID 1.2.840.113635.100.6.2.10.
871 * The leaf has a marker extension with OID 1.2.840.113635.100.6.25.
872 * Revocation is checked via OCSP.
873 @result A policy object. The caller is responsible for calling CFRelease
874 on this when it is no longer needed.
875 */
876 __nullable CF_RETURNS_RETAINED
877 SecPolicyRef SecPolicyCreateAppleIDValidationRecordSigningPolicy(void);
878
879 /*!
880 @function SecPolicyCreateAppleSMPEncryption
881 @abstract Returns a policy object for evaluating SMP certificate chains.
882 @discussion This policy uses the Basic X.509 policy with no validity check
883 and pinning options:
884 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
885 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
886 * There are exactly 3 certs in the chain.
887 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.13.
888 * The leaf has KeyUsage with the KeyEncipherment bit set.
889 * The leaf has a marker extension with OID 1.2.840.113635.100.6.30.
890 * Revocation is checked via OCSP.
891 @result A policy object. The caller is responsible for calling CFRelease
892 on this when it is no longer needed.
893 */
894 __nullable CF_RETURNS_RETAINED
895 SecPolicyRef SecPolicyCreateAppleSMPEncryption(void);
896
897 /*!
898 @function SecPolicyCreateTestAppleSMPEncryption
899 @abstract Returns a policy object for evaluating Test SMP certificate chains.
900 @discussion This policy uses the Basic X.509 policy with no validity check
901 and pinning options:
902 * The chain is anchored to a Test Apple Root with ECC public key certificate.
903 * There are exactly 3 certs in the chain.
904 * The intermediate has Common Name "Test Apple System Integration CA - ECC".
905 * The leaf has KeyUsage with the KeyEncipherment bit set.
906 * Revocation is checked via OCSP.
907 @result A policy object. The caller is responsible for calling CFRelease
908 on this when it is no longer needed.
909 */
910 __nullable CF_RETURNS_RETAINED
911 SecPolicyRef SecPolicyCreateTestAppleSMPEncryption(void);
912
913 /*!
914 @function SecPolicyCreateApplePPQSigning
915 @abstract Returns a policy object for verifying production PPQ Signing certificates.
916 @discussion This policy uses the Basic X.509 policy with no validity check
917 and pinning options:
918 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
919 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
920 * There are exactly 3 certs in the chain.
921 * The intermediate has Common Name "Apple System Integration 2 Certification
922 Authority".
923 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.10.
924 * The leaf has KeyUsage with the DigitalSignature bit set.
925 * The leaf has a marker extension with OID 1.2.840.113635.100.6.38.2.
926 @result A policy object. The caller is responsible for calling CFRelease
927 on this when it is no longer needed.
928 */
929 __nullable CF_RETURNS_RETAINED
930 SecPolicyRef SecPolicyCreateApplePPQSigning(void);
931
932 /*!
933 @function SecPolicyCreateTestApplePPQSigning
934 @abstract Returns a policy object for verifying test PPQ Signing certificates. On
935 customer builds, this function returns the same policy as SecPolicyCreateApplePPQSigning.
936 @discussion This policy uses the Basic X.509 policy with no validity check
937 and pinning options:
938 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
939 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
940 * There are exactly 3 certs in the chain.
941 * The intermediate has Common Name "Apple System Integration 2 Certification
942 Authority".
943 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.10.
944 * The leaf has KeyUsage with the DigitalSignature bit set.
945 * The leaf has a marker extension with OID 1.2.840.113635.100.6.38.1.
946 @result A policy object. The caller is responsible for calling CFRelease
947 on this when it is no longer needed.
948 */
949 __nullable CF_RETURNS_RETAINED
950 SecPolicyRef SecPolicyCreateTestApplePPQSigning(void);
951
952 /*!
953 @function SecPolicyCreateAppleIDSService
954 @abstract Ensure we're appropriately pinned to the IDS service (SSL + Apple restrictions)
955 @discussion This policy uses the SSL server policy.
956 @result A policy object. The caller is responsible for calling CFRelease
957 on this when it is no longer needed.
958 */
959 __nullable CF_RETURNS_RETAINED
960 SecPolicyRef SecPolicyCreateAppleIDSService(CFStringRef __nullable hostname);
961
962 /*!
963 @function SecPolicyCreateAppleIDSServiceContext
964 @abstract Ensure we're appropriately pinned to the IDS service (SSL + Apple restrictions)
965 @param hostname Required; hostname to verify the certificate name against.
966 @param context Optional; if present, "AppleServerAuthenticationAllowUATIDS" with value
967 Boolean true will allow Test Apple roots on internal releases.
968 @discussion This policy uses the Basic X.509 policy with validity check
969 and pinning options:
970 * The chain is anchored to any of the production Apple Root CAs. Test Apple Root CAs
971 are permitted only on internal releases either using the context dictionary or with
972 defaults write.
973 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
974 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.4.2 or,
975 if Test Roots are allowed, OID 1.2.840.113635.100.6.27.4.1.
976 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
977 extension or Common Name.
978 * The leaf is checked against the Black and Gray lists.
979 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
980 * Revocation is checked via any available method.
981 @result A policy object. The caller is responsible for calling CFRelease
982 on this when it is no longer needed.
983 */
984 __nullable CF_RETURNS_RETAINED
985 SecPolicyRef SecPolicyCreateAppleIDSServiceContext(CFStringRef hostname, CFDictionaryRef __nullable context);
986
987 /*!
988 @function SecPolicyCreateApplePushService
989 @abstract Ensure we're appropriately pinned to the Apple Push service (SSL + Apple restrictions)
990 @param hostname Required; hostname to verify the certificate name against.
991 @param context Optional; if present, "AppleServerAuthenticationAllowUATAPN" with value
992 Boolean true will allow Test Apple roots on internal releases.
993 @discussion This policy uses the Basic X.509 policy with validity check
994 and pinning options:
995 * The chain is anchored to any of the production Apple Root CAs. Test Apple Root CAs
996 are permitted only on internal releases either using the context dictionary or with
997 defaults write.
998 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
999 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.5.2 or,
1000 if Test Roots are allowed, OID 1.2.840.113635.100.6.27.5.1.
1001 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1002 extension or Common Name.
1003 * The leaf is checked against the Black and Gray lists.
1004 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1005 * Revocation is checked via any available method.
1006 @result A policy object. The caller is responsible for calling CFRelease
1007 on this when it is no longer needed.
1008 */
1009 __nullable CF_RETURNS_RETAINED
1010 SecPolicyRef SecPolicyCreateApplePushService(CFStringRef hostname, CFDictionaryRef __nullable context);
1011
1012 /*!
1013 @function SecPolicyCreateApplePushServiceLegacy
1014 @abstract Ensure we're appropriately pinned to the Push service (via Entrust)
1015 @param hostname Required; hostname to verify the certificate name against.
1016 @discussion This policy uses the Basic X.509 policy with validity check
1017 and pinning options:
1018 * The chain is anchored to an Entrust Intermediate.
1019 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1020 extension or Common Name.
1021 * The leaf is checked against the Black and Gray lists.
1022 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1023 * Revocation is checked via any available method.
1024 @result A policy object. The caller is responsible for calling CFRelease
1025 on this when it is no longer needed.
1026 */
1027 __nullable CF_RETURNS_RETAINED
1028 SecPolicyRef SecPolicyCreateApplePushServiceLegacy(CFStringRef hostname);
1029
1030 /*!
1031 @function SecPolicyCreateAppleMMCSService
1032 @abstract Ensure we're appropriately pinned to the MMCS service (SSL + Apple restrictions)
1033 @param hostname Required; hostname to verify the certificate name against.
1034 @param context Optional; if present, "AppleServerAuthenticationAllowUATMMCS" with value
1035 Boolean true will allow Test Apple roots and test OIDs on internal releases.
1036 @discussion This policy uses the Basic X.509 policy with validity check
1037 and pinning options:
1038 * The chain is anchored to any of the production Apple Root CAs.
1039 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1040 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.11.2 or, if
1041 enabled, OID 1.2.840.113635.100.6.27.11.1.
1042 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1043 extension or Common Name.
1044 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1045 * Revocation is checked via any available method.
1046 @result A policy object. The caller is responsible for calling CFRelease
1047 on this when it is no longer needed.
1048 */
1049 __nullable CF_RETURNS_RETAINED
1050 SecPolicyRef SecPolicyCreateAppleMMCSService(CFStringRef hostname, CFDictionaryRef __nullable context);
1051
1052 /*!
1053 @function SecPolicyCreateAppleCompatibilityMMCSService
1054 @abstract Ensure we're appropriately pinned to the MMCS service using compatibility certs
1055 @param hostname Required; hostname to verify the certificate name against.
1056 @discussion This policy uses the Basic X.509 policy with validity check
1057 and pinning options:
1058 * The chain is anchored to the GeoTrust Global CA
1059 * The intermediate has a subject public key info hash matching the public key of
1060 the Apple IST CA G1 intermediate.
1061 * The chain length is 3.
1062 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.11.2 or
1063 OID 1.2.840.113635.100.6.27.11.1.
1064 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1065 extension or Common Name.
1066 * The leaf is checked against the Black and Gray lists.
1067 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1068 @result A policy object. The caller is responsible for calling CFRelease
1069 on this when it is no longer needed.
1070 */
1071 __nullable CF_RETURNS_RETAINED
1072 SecPolicyRef SecPolicyCreateAppleCompatibilityMMCSService(CFStringRef hostname)
1073 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
1074
1075 /*!
1076 @function SecPolicyCreateAppleGSService
1077 @abstract Ensure we're appropriately pinned to the GS service (SSL + Apple restrictions)
1078 @param hostname Required; hostname to verify the certificate name against.
1079 @param context Optional; if present, "AppleServerAuthenticationAllowUATGS" with value
1080 Boolean true will allow Test Apple roots on internal releases.
1081 @discussion This policy uses the Basic X.509 policy with validity check
1082 and pinning options:
1083 * The chain is anchored to any of the production Apple Root CAs. Test Apple Root CAs
1084 are permitted only on internal releases either using the context dictionary or with
1085 defaults write.
1086 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1087 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.2.
1088 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1089 extension or Common Name.
1090 * The leaf is checked against the Black and Gray lists.
1091 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1092 * Revocation is checked via any available method.
1093 @result A policy object. The caller is responsible for calling CFRelease
1094 on this when it is no longer needed.
1095 */
1096 __nullable CF_RETURNS_RETAINED
1097 SecPolicyRef SecPolicyCreateAppleGSService(CFStringRef hostname, CFDictionaryRef __nullable context)
1098 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
1099
1100 /*!
1101 @function SecPolicyCreateApplePPQService
1102 @abstract Ensure we're appropriately pinned to the PPQ service (SSL + Apple restrictions)
1103 @param hostname Required; hostname to verify the certificate name against.
1104 @param context Optional; if present, "AppleServerAuthenticationAllowUATPPQ" with value
1105 Boolean true will allow Test Apple roots on internal releases.
1106 @discussion This policy uses the Basic X.509 policy with validity check
1107 and pinning options:
1108 * The chain is anchored to any of the production Apple Root CAs. Test Apple Root CAs
1109 are permitted only on internal releases either using the context dictionary or with
1110 defaults write.
1111 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1112 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.3.2 or,
1113 if Test Roots are allowed, OID 1.2.840.113635.100.6.27.3.1.
1114 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1115 extension or Common Name.
1116 * The leaf is checked against the Black and Gray lists.
1117 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1118 * Revocation is checked via any available method.
1119 @result A policy object. The caller is responsible for calling CFRelease
1120 on this when it is no longer needed.
1121 */
1122 __nullable CF_RETURNS_RETAINED
1123 SecPolicyRef SecPolicyCreateApplePPQService(CFStringRef hostname, CFDictionaryRef __nullable context)
1124 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
1125
1126 /*!
1127 @function SecPolicyCreateAppleAST2Service
1128 @abstract Ensure we're appropriately pinned to the AST2 Diagnostic service (SSL + Apple restrictions)
1129 @param hostname Required; hostname to verify the certificate name against.
1130 @param context Optional; if present, "AppleServerAuthenticationAllowUATAST2" with value
1131 Boolean true will allow Test Apple roots on internal releases.
1132 @discussion This policy uses the Basic X.509 policy with validity check
1133 and pinning options:
1134 * The chain is anchored to any of the production Apple Root CAs. Test Apple Root CAs
1135 are permitted either using the context dictionary or with defaults write.
1136 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1137 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.8.2 or,
1138 if Test Roots are allowed, OID 1.2.840.113635.100.6.27.8.1.
1139 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1140 extension or Common Name.
1141 * The leaf is checked against the Black and Gray lists.
1142 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1143 * Revocation is checked via any available method.
1144 @result A policy object. The caller is responsible for calling CFRelease
1145 on this when it is no longer needed.
1146 */
1147 __nullable CF_RETURNS_RETAINED
1148 SecPolicyRef SecPolicyCreateAppleAST2Service(CFStringRef hostname, CFDictionaryRef __nullable context)
1149 __OSX_AVAILABLE_STARTING(__MAC_10_11_4, __IPHONE_9_3);
1150
1151 /*!
1152 @function SecPolicyCreateAppleEscrowProxyService
1153 @abstract Ensure we're appropriately pinned to the iCloud Escrow Proxy service (SSL + Apple restrictions)
1154 @param hostname Required; hostname to verify the certificate name against.
1155 @param context Optional; if present, "AppleServerAuthenticationAllowUATEscrow" with value
1156 Boolean true will allow Test Apple roots on internal releases.
1157 @discussion This policy uses the Basic X.509 policy with validity check
1158 and pinning options:
1159 * The chain is anchored to any of the production Apple Root CAs via full certificate
1160 comparison. Test Apple Root CAs are permitted only on internal releases either
1161 using the context dictionary or with defaults write.
1162 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1163 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.7.2 or,
1164 if Test Roots are allowed, OID 1.2.840.113635.100.6.27.7.1.
1165 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1166 extension or Common Name.
1167 * The leaf is checked against the Black and Gray lists.
1168 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1169 * Revocation is checked via any available method.
1170 @result A policy object. The caller is responsible for calling CFRelease
1171 on this when it is no longer needed.
1172 */
1173 __nullable CF_RETURNS_RETAINED
1174 SecPolicyRef SecPolicyCreateAppleEscrowProxyService(CFStringRef hostname, CFDictionaryRef __nullable context)
1175 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
1176
1177 /*!
1178 @function SecPolicyCreateAppleCompatibilityEscrowProxyService
1179 @abstract Ensure we're appropriately pinned to the iCloud Escrow Proxy service using compatibility certs
1180 @param hostname Required; hostname to verify the certificate name against.
1181 @discussion This policy uses the Basic X.509 policy with validity check
1182 and pinning options:
1183 * The chain is anchored to the GeoTrust Global CA
1184 * The intermediate has a subject public key info hash matching the public key of
1185 the Apple IST CA G1 intermediate.
1186 * The chain length is 3.
1187 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.7.2 or,
1188 if UAT is enabled with a defaults write (internal devices only),
1189 OID 1.2.840.113635.100.6.27.7.1.
1190 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1191 extension or Common Name.
1192 * The leaf is checked against the Black and Gray lists.
1193 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1194 @result A policy object. The caller is responsible for calling CFRelease
1195 on this when it is no longer needed.
1196 */
1197 __nullable CF_RETURNS_RETAINED
1198 SecPolicyRef SecPolicyCreateAppleCompatibilityEscrowProxyService(CFStringRef hostname)
1199 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
1200
1201 /*!
1202 @function SecPolicyCreateAppleFMiPService
1203 @abstract Ensure we're appropriately pinned to the Find My iPhone service (SSL + Apple restrictions)
1204 @param hostname Required; hostname to verify the certificate name against.
1205 @param context Optional; if present, "AppleServerAuthenticationAllowUATFMiP" with value
1206 Boolean true will allow Test Apple roots on internal releases.
1207 @discussion This policy uses the Basic X.509 policy with validity check
1208 and pinning options:
1209 * The chain is anchored to any of the production Apple Root CAs via full certificate
1210 comparison. Test Apple Root CAs are permitted only on internal releases either
1211 using the context dictionary or with defaults write.
1212 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1213 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.6.2 or,
1214 if Test Roots are allowed, OID 1.2.840.113635.100.6.27.6.1.
1215 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1216 extension or Common Name.
1217 * The leaf is checked against the Black and Gray lists.
1218 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1219 * Revocation is checked via any available method.
1220 @result A policy object. The caller is responsible for calling CFRelease
1221 on this when it is no longer needed.
1222 */
1223 __nullable CF_RETURNS_RETAINED
1224 SecPolicyRef SecPolicyCreateAppleFMiPService(CFStringRef hostname, CFDictionaryRef __nullable context)
1225 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
1226
1227 /*!
1228 @function SecPolicyCreateAppleSSLService
1229 @abstract Ensure we're appropriately pinned to an Apple server (SSL + Apple restrictions)
1230 @param hostname Optional; hostname to verify the certificate name against.
1231 @discussion This policy uses the Basic X.509 policy with validity check
1232 and pinning options:
1233 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
1234 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
1235 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1236 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.1
1237 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1238 extension or Common Name.
1239 * The leaf is checked against the Black and Gray lists.
1240 * The leaf has ExtendedKeyUsage, if any, with the ServerAuth OID.
1241 * Revocation is checked via any available method.
1242 @result A policy object. The caller is responsible for calling CFRelease
1243 on this when it is no longer needed.
1244 */
1245 __nullable CF_RETURNS_RETAINED
1246 SecPolicyRef SecPolicyCreateAppleSSLService(CFStringRef __nullable hostname);
1247
1248 /*!
1249 @function SecPolicyCreateAppleTimeStamping
1250 @abstract Returns a policy object for evaluating time stamping certificate chains.
1251 @discussion This policy uses the Basic X.509 policy with validity check
1252 and requires the leaf has ExtendedKeyUsage with the TimeStamping OID.
1253 @result A policy object. The caller is responsible for calling CFRelease
1254 on this when it is no longer needed.
1255 */
1256 __nullable CF_RETURNS_RETAINED
1257 SecPolicyRef SecPolicyCreateAppleTimeStamping(void);
1258
1259 /*!
1260 @function SecPolicyCreateApplePayIssuerEncryption
1261 @abstract Returns a policy object for evaluating Apple Pay Issuer Encryption certificate chains.
1262 @discussion This policy uses the Basic X.509 policy with no validity check
1263 and pinning options:
1264 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
1265 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
1266 * There are exactly 3 certs in the chain.
1267 * The intermediate has Common Name "Apple Worldwide Developer Relations CA - G2".
1268 * The leaf has KeyUsage with the KeyEncipherment bit set.
1269 * The leaf has a marker extension with OID 1.2.840.113635.100.6.39.
1270 @result A policy object. The caller is responsible for calling CFRelease
1271 on this when it is no longer needed.
1272 */
1273 __nullable CF_RETURNS_RETAINED
1274 SecPolicyRef SecPolicyCreateApplePayIssuerEncryption(void)
1275 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
1276
1277 /*!
1278 @function SecPolicyCreateAppleATVVPNProfileSigning
1279 @abstract Returns a policy object for evaluating Apple TV VPN Profile certificate chains.
1280 @discussion This policy uses the Basic X.509 policy with no validity check
1281 and pinning options:
1282 * The chain is anchored to any of the production Apple Root CAs. Test Apple Root CAs
1283 are permitted only on internal releases.
1284 * There are exactly 3 certs in the chain.
1285 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.10.
1286 * The leaf has a marker extension with OID 1.2.840.113635.100.6.43.
1287 * Revocation is checked via OCSP.
1288 @result A policy object. The caller is responsible for calling CFRelease
1289 on this when it is no longer needed.
1290 */
1291 __nullable CF_RETURNS_RETAINED
1292 SecPolicyRef SecPolicyCreateAppleATVVPNProfileSigning(void)
1293 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
1294
1295 /*!
1296 @function SecPolicyCreateAppleHomeKitServerAuth
1297 @abstract Ensure we're appropriately pinned to the HomeKit service (SSL + Apple restrictions)
1298 @param hostname Required; hostname to verify the certificate name against.
1299 @discussion This policy uses the Basic X.509 policy with validity check
1300 and pinning options:
1301 * The chain is anchored to any of the production Apple Root CAs via full certificate
1302 comparison. Test Apple Root CAs are permitted only on internal releases with defaults write.
1303 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.16
1304 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.9.
1305 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1306 extension or Common Name.
1307 * The leaf is checked against the Black and Gray lists.
1308 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1309 * Revocation is checked via any available method.
1310 @result A policy object. The caller is responsible for calling CFRelease
1311 on this when it is no longer needed.
1312 */
1313 __nullable CF_RETURNS_RETAINED
1314 SecPolicyRef SecPolicyCreateAppleHomeKitServerAuth(CFStringRef hostname)
1315 __OSX_AVAILABLE_STARTING(__MAC_10_11_4, __IPHONE_9_3);
1316
1317 /*!
1318 @function SecPolicyCreateAppleExternalDeveloper
1319 @abstract Returns a policy object for verifying Apple-issued external developer
1320 certificates.
1321 @discussion The resulting policy uses the Basic X.509 policy with validity check and
1322 pinning options:
1323 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
1324 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
1325 * There are exactly 3 certs in the chain.
1326 * The intermediate has a marker extension with OID matching 1.2.840.113635.100.6.2.1
1327 (WWDR CA) or 1.2.840.113635.100.6.2.6 (Developer ID CA).
1328 * The leaf has a marker extension with OID matching one of the following:
1329 * 1.2.840.113635.100.6.1.2 ("iPhone Developer" leaf)
1330 * 1.2.840.113635.100.6.1.4 ("iPhone Distribution" leaf)
1331 * 1.2.840.113635.100.6.1.5 ("Safari Developer" leaf)
1332 * 1.2.840.113635.100.6.1.7 ("3rd Party Mac Developer Application" leaf)
1333 * 1.2.840.113635.100.6.1.8 ("3rd Party Mac Developer Installer" leaf)
1334 * 1.2.840.113635.100.6.1.12 ("Mac Developer" leaf)
1335 * 1.2.840.113635.100.6.1.13 ("Developer ID Application" leaf)
1336 * 1.2.840.113635.100.6.1.14 ("Developer ID Installer" leaf)
1337 * The leaf has an ExtendedKeyUsage OID matching one of the following:
1338 * 1.3.6.1.5.5.7.3.3 (CodeSigning EKU)
1339 * 1.2.840.113635.100.4.8 ("Safari Developer" EKU)
1340 * 1.2.840.113635.100.4.9 ("3rd Party Mac Developer Installer" EKU)
1341 * 1.2.840.113635.100.4.13 ("Developer ID Installer" EKU)
1342 * Revocation is checked via any available method.
1343 * RSA key sizes are 2048-bit or larger. EC key sizes are P-256 or larger.
1344 @result A policy object. The caller is responsible for calling CFRelease on this when
1345 it is no longer needed.
1346 */
1347 __nullable CF_RETURNS_RETAINED
1348 SecPolicyRef SecPolicyCreateAppleExternalDeveloper(void)
1349 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
1350
1351 /*!
1352 @function SecPolicyCreateAppleSoftwareSigning
1353 @abstract Returns a policy object for verifying the Apple Software Signing certificate.
1354 @discussion The resulting policy uses the Basic X.509 policy with validity check and
1355 pinning options:
1356 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
1357 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
1358 * There are exactly 3 certs in the chain.
1359 * The intermediate has the Common Name "Apple Code Signing Certification Authority".
1360 * The leaf has a marker extension with OID matching 1.2.840.113635.100.6.22.
1361 * The leaf has an ExtendedKeyUsage OID matching 1.3.6.1.5.5.7.3.3 (Code Signing).
1362 * Revocation is checked via any available method.
1363 * RSA key sizes are 2048-bit or larger. EC key sizes are P-256 or larger.
1364 @result A policy object. The caller is responsible for calling CFRelease on this when
1365 it is no longer needed.
1366 */
1367 __nullable CF_RETURNS_RETAINED
1368 SecPolicyRef SecPolicyCreateAppleSoftwareSigning(void)
1369 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
1370
1371 /*!
1372 @function SecPolicyGetName
1373 @abstract Returns a policy's name.
1374 @param policy A policy reference.
1375 @result A policy name.
1376 */
1377 __nullable CFStringRef SecPolicyGetName(SecPolicyRef policy)
1378 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
1379
1380 /*!
1381 @function SecPolicyGetOidString
1382 @abstract Returns a policy's oid in string decimal format.
1383 @param policy A policy reference.
1384 @result A policy oid.
1385 */
1386 CFStringRef SecPolicyGetOidString(SecPolicyRef policy)
1387 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
1388
1389 /*!
1390 @function SecPolicyCreateAppleUniqueDeviceCertificate
1391 @abstract Returns a policy object for verifying Unique Device Identifier Certificates.
1392 @param testRootHash Optional; The SHA-256 fingerprint of a test root for pinning.
1393 @discussion The resulting policy uses the Basic X.509 policy with no validity check and
1394 pinning options:
1395 * The chain is anchored to the SEP Root CA. Internal releases allow the chain to be
1396 anchored to the testRootHash input if the value true is set for the key
1397 "ApplePinningAllowTestCertsUCRT" in the com.apple.security preferences for the user
1398 of the calling application.
1399 * There are exactly 3 certs in the chain.
1400 * The intermediate has an extension with OID matching 1.2.840.113635.100.6.44 and value
1401 of "ucrt".
1402 * The leaf has a marker extension with OID matching 1.2.840.113635.100.10.1.
1403 * RSA key sizes are disallowed. EC key sizes are P-256 or larger.
1404 @result A policy object. The caller is responsible for calling CFRelease on this when
1405 it is no longer needed.
1406 */
1407 __nullable CF_RETURNS_RETAINED
1408 SecPolicyRef SecPolicyCreateAppleUniqueDeviceCertificate(CFDataRef __nullable testRootHash)
1409 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
1410
1411 /*!
1412 @function SecPolicyCreateAppleWarsaw
1413 @abstract Returns a policy object for verifying signed Warsaw assets.
1414 @discussion The resulting policy uses the Basic X.509 policy with validity check and
1415 pinning options:
1416 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
1417 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
1418 * There are exactly 3 certs in the chain.
1419 * The intermediate has an extension with OID matching 1.2.840.113635.100.6.2.14.
1420 * The leaf has a marker extension with OID matching 1.2.840.113635.100.6.29.
1421 * RSA key sizes are 2048-bit or larger. EC key sizes are P-256 or larger.
1422 @result A policy object. The caller is responsible for calling CFRelease on this when
1423 it is no longer needed.
1424 */
1425 __nullable CF_RETURNS_RETAINED
1426 SecPolicyRef SecPolicyCreateAppleWarsaw(void)
1427 __OSX_AVAILABLE(10.12.1) __IOS_AVAILABLE(10.1) __TVOS_AVAILABLE(10.0.1) __WATCHOS_AVAILABLE(3.1);
1428
1429 /*!
1430 @function SecPolicyCreateAppleSecureIOStaticAsset
1431 @abstract Returns a policy object for verifying signed static assets for Secure IO.
1432 @discussion The resulting policy uses the Basic X.509 policy with no validity check and
1433 pinning options:
1434 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
1435 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
1436 * There are exactly 3 certs in the chain.
1437 * The intermediate has an extension with OID matching 1.2.840.113635.100.6.2.10.
1438 * The leaf has a marker extension with OID matching 1.2.840.113635.100.6.50.
1439 * RSA key sizes are 2048-bit or larger. EC key sizes are P-256 or larger.
1440 @result A policy object. The caller is responsible for calling CFRelease on this when
1441 it is no longer needed.
1442 */
1443 __nullable CF_RETURNS_RETAINED
1444 SecPolicyRef SecPolicyCreateAppleSecureIOStaticAsset(void)
1445 __OSX_AVAILABLE(10.12.1) __IOS_AVAILABLE(10.1) __TVOS_AVAILABLE(10.0.1) __WATCHOS_AVAILABLE(3.1);
1446
1447 /*!
1448 @function SecPolicyCreateAppleiCloudSetupService
1449 @abstract Ensure we're appropriately pinned to the iCloud Setup service (SSL + Apple restrictions)
1450 @param hostname Required; hostname to verify the certificate name against.
1451 @param context Optional; if present, "AppleServerAuthenticationAllowUATiCloudSetup" with value
1452 Boolean true will allow Test Apple roots and test OIDs on internal releases.
1453 @discussion This policy uses the Basic X.509 policy with validity check
1454 and pinning options:
1455 * The chain is anchored to any of the production Apple Root CAs.
1456 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1457 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.15.2 or, if
1458 enabled, OID 1.2.840.113635.100.6.27.15.1.
1459 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1460 extension or Common Name.
1461 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1462 * Revocation is checked via any available method.
1463 @result A policy object. The caller is responsible for calling CFRelease
1464 on this when it is no longer needed.
1465 */
1466 __nullable CF_RETURNS_RETAINED
1467 SecPolicyRef SecPolicyCreateAppleiCloudSetupService(CFStringRef hostname, CFDictionaryRef __nullable context)
1468 __OSX_AVAILABLE(10.12.4) __IOS_AVAILABLE(10.3) __TVOS_AVAILABLE(10.2) __WATCHOS_AVAILABLE(3.2);
1469
1470 /*!
1471 @function SecPolicyCreateAppleCompatibilityiCloudSetupService
1472 @abstract Ensure we're appropriately pinned to the iCloud Setup service using compatibility certs
1473 @param hostname Required; hostname to verify the certificate name against.
1474 @discussion This policy uses the Basic X.509 policy with validity check
1475 and pinning options:
1476 * The chain is anchored to the GeoTrust Global CA
1477 * The intermediate has a subject public key info hash matching the public key of
1478 the Apple IST CA G1 intermediate.
1479 * The chain length is 3.
1480 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.15.2 or
1481 OID 1.2.840.113635.100.6.27.15.1.
1482 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1483 extension or Common Name.
1484 * The leaf is checked against the Black and Gray lists.
1485 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1486 @result A policy object. The caller is responsible for calling CFRelease
1487 on this when it is no longer needed.
1488 */
1489 __nullable CF_RETURNS_RETAINED
1490 SecPolicyRef SecPolicyCreateAppleCompatibilityiCloudSetupService(CFStringRef hostname)
1491 __OSX_AVAILABLE(10.12.4) __IOS_AVAILABLE(10.3) __TVOS_AVAILABLE(10.2) __WATCHOS_AVAILABLE(3.2);
1492
1493
1494 CF_IMPLICIT_BRIDGING_DISABLED
1495 CF_ASSUME_NONNULL_END
1496
1497 /*
1498 * Legacy functions (OS X only)
1499 */
1500 #if TARGET_OS_MAC && !TARGET_OS_IPHONE
1501
1502 CF_ASSUME_NONNULL_BEGIN
1503 CF_IMPLICIT_BRIDGING_ENABLED
1504
1505 /*!
1506 @function SecPolicyCopy
1507 @abstract Returns a copy of a policy reference based on certificate type and OID.
1508 @param certificateType A certificate type.
1509 @param policyOID The OID of the policy you want to find. This is a required parameter. See oidsalg.h to see a list of policy OIDs.
1510 @param policy The returned policy reference. This is a required parameter.
1511 @result A result code. See "Security Error Codes" (SecBase.h).
1512 @discussion This function is deprecated in Mac OS X 10.7 and later;
1513 to obtain a policy reference, use one of the SecPolicyCreate* functions in SecPolicy.h.
1514 */
1515 OSStatus SecPolicyCopy(CSSM_CERT_TYPE certificateType, const CSSM_OID *policyOID, SecPolicyRef * __nonnull CF_RETURNS_RETAINED policy)
1516 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_3, __MAC_10_7, __IPHONE_NA, __IPHONE_NA);
1517
1518 /*!
1519 @function SecPolicyCopyAll
1520 @abstract Returns an array of all known policies based on certificate type.
1521 @param certificateType A certificate type. This is a optional parameter. Pass CSSM_CERT_UNKNOWN if the certificate type is unknown.
1522 @param policies The returned array of policies. This is a required parameter.
1523 @result A result code. See "Security Error Codes" (SecBase.h).
1524 @discussion This function is deprecated in Mac OS X 10.7 and later;
1525 to obtain a policy reference, use one of the SecPolicyCreate* functions in SecPolicy.h. (Note: there is normally
1526 no reason to iterate over multiple disjointed policies, except to provide a way to edit trust settings for each
1527 policy, as is done in certain certificate UI views. In that specific case, your code should call SecPolicyCreateWithOID
1528 for each desired policy from the list of supported OID constants in SecPolicy.h.)
1529 */
1530 OSStatus SecPolicyCopyAll(CSSM_CERT_TYPE certificateType, CFArrayRef * __nonnull CF_RETURNS_RETAINED policies)
1531 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_3, __MAC_10_7, __IPHONE_NA, __IPHONE_NA);
1532
1533 /* Given a unified SecPolicyRef, return a copy with a legacy
1534 C++ ItemImpl-based Policy instance. Only for internal use;
1535 legacy references cannot be used by SecPolicy API functions. */
1536 __nullable CF_RETURNS_RETAINED
1537 SecPolicyRef SecPolicyCreateItemImplInstance(SecPolicyRef policy);
1538
1539 /* Given a CSSM_OID pointer, return a string which can be passed
1540 to SecPolicyCreateWithProperties. The return value can be NULL
1541 if no supported policy was found for the OID argument. */
1542 __nullable
1543 CFStringRef SecPolicyGetStringForOID(CSSM_OID* oid);
1544
1545 /*!
1546 @function SecPolicyCreateAppleTimeStampingAndRevocationPolicies
1547 @abstract Create timeStamping policy array from a given set of policies by applying identical revocation behavior
1548 @param policyOrArray can be a SecPolicyRef or a CFArray of SecPolicyRef
1549 @discussion This function is soon to be deprecated. Callers should create an array of the non-deprecated timestamping
1550 and revocation policies.
1551 */
1552 __nullable CF_RETURNS_RETAINED
1553 CFArrayRef SecPolicyCreateAppleTimeStampingAndRevocationPolicies(CFTypeRef policyOrArray);
1554
1555 CF_IMPLICIT_BRIDGING_DISABLED
1556 CF_ASSUME_NONNULL_END
1557
1558 #endif /* TARGET_OS_MAC && !TARGET_OS_IPHONE */
1559
1560 __END_DECLS
1561
1562 #endif /* !_SECURITY_SECPOLICYPRIV_H_ */