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