]> git.saurik.com Git - apple/security.git/blob - trust/SecPolicyPriv.h
b40920e0e19c982d311b1faec6c70afdd7490523
[apple/security.git] / trust / SecPolicyPriv.h
1 /*
2 * Copyright (c) 2003-2017 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 #include <xpc/xpc.h>
40
41 __BEGIN_DECLS
42
43 CF_ASSUME_NONNULL_BEGIN
44 CF_IMPLICIT_BRIDGING_ENABLED
45
46 /*!
47 @enum Policy Constants (Private)
48 @discussion Predefined constants used to specify a policy.
49 */
50 extern const CFStringRef kSecPolicyAppleMobileStore
51 __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
52 extern const CFStringRef kSecPolicyAppleTestMobileStore
53 __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
54 extern const CFStringRef kSecPolicyAppleEscrowService
55 __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
56 extern const CFStringRef kSecPolicyAppleProfileSigner
57 __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
58 extern const CFStringRef kSecPolicyAppleQAProfileSigner
59 __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
60 extern const CFStringRef kSecPolicyAppleServerAuthentication
61 __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
62 extern const CFStringRef kSecPolicyAppleOTAPKISigner
63 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_12, __MAC_10_13_4, __IPHONE_7_0, __IPHONE_11_3);
64 extern const CFStringRef kSecPolicyAppleTestOTAPKISigner
65 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_12, __MAC_10_13_4, __IPHONE_7_0, __IPHONE_11_3);
66 extern const CFStringRef kSecPolicyAppleIDValidationRecordSigningPolicy
67 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_7_0, __IPHONE_10_0);
68 extern const CFStringRef kSecPolicyAppleIDValidationRecordSigning
69 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
70 extern const CFStringRef kSecPolicyAppleSMPEncryption
71 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_8_0);
72 extern const CFStringRef kSecPolicyAppleTestSMPEncryption
73 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_8_0);
74 extern const CFStringRef kSecPolicyApplePCSEscrowService
75 __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_0);
76 extern const CFStringRef kSecPolicyApplePPQSigning
77 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
78 extern const CFStringRef kSecPolicyAppleTestPPQSigning
79 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
80 extern const CFStringRef kSecPolicyAppleSWUpdateSigning
81 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
82 extern const CFStringRef kSecPolicyApplePackageSigning
83 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
84 extern const CFStringRef kSecPolicyAppleOSXProvisioningProfileSigning
85 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
86 extern const CFStringRef kSecPolicyAppleATVVPNProfileSigning
87 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
88 extern const CFStringRef kSecPolicyAppleAST2DiagnosticsServerAuth
89 __OSX_AVAILABLE_STARTING(__MAC_10_11_4, __IPHONE_9_3);
90 extern const CFStringRef kSecPolicyAppleEscrowProxyServerAuth
91 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
92 extern const CFStringRef kSecPolicyAppleFMiPServerAuth
93 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
94 extern const CFStringRef kSecPolicyAppleMMCService
95 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
96 extern const CFStringRef kSecPolicyAppleGSService
97 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
98 extern const CFStringRef kSecPolicyApplePPQService
99 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
100 extern const CFStringRef kSecPolicyAppleHomeKitServerAuth
101 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
102 extern const CFStringRef kSecPolicyAppleiPhoneActivation
103 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
104 extern const CFStringRef kSecPolicyAppleiPhoneDeviceCertificate
105 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
106 extern const CFStringRef kSecPolicyAppleFactoryDeviceCertificate
107 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
108 extern const CFStringRef kSecPolicyAppleiAP
109 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
110 extern const CFStringRef kSecPolicyAppleiTunesStoreURLBag
111 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
112 extern const CFStringRef kSecPolicyAppleiPhoneApplicationSigning
113 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
114 extern const CFStringRef kSecPolicyAppleiPhoneProfileApplicationSigning
115 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
116 extern const CFStringRef kSecPolicyAppleiPhoneProvisioningProfileSigning
117 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
118 extern const CFStringRef kSecPolicyAppleLockdownPairing
119 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
120 extern const CFStringRef kSecPolicyAppleURLBag
121 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
122 extern const CFStringRef kSecPolicyAppleOTATasking
123 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
124 extern const CFStringRef kSecPolicyAppleMobileAsset
125 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
126 extern const CFStringRef kSecPolicyAppleIDAuthority
127 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
128 extern const CFStringRef kSecPolicyAppleGenericApplePinned
129 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
130 extern const CFStringRef kSecPolicyAppleGenericAppleSSLPinned
131 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
132 extern const CFStringRef kSecPolicyAppleSoftwareSigning
133 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
134 extern const CFStringRef kSecPolicyAppleExternalDeveloper
135 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
136 extern const CFStringRef kSecPolicyAppleOCSPSigner
137 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
138 extern const CFStringRef kSecPolicyAppleIDSService
139 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
140 extern const CFStringRef kSecPolicyAppleIDSServiceContext
141 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
142 extern const CFStringRef kSecPolicyApplePushService
143 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
144 extern const CFStringRef kSecPolicyAppleLegacyPushService
145 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
146 extern const CFStringRef kSecPolicyAppleTVOSApplicationSigning
147 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
148 extern const CFStringRef kSecPolicyAppleUniqueDeviceIdentifierCertificate
149 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
150 extern const CFStringRef kSecPolicyAppleEscrowProxyCompatibilityServerAuth
151 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
152 extern const CFStringRef kSecPolicyAppleMMCSCompatibilityServerAuth
153 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
154 extern const CFStringRef kSecPolicyAppleSecureIOStaticAsset
155 __OSX_AVAILABLE(10.12.1) __IOS_AVAILABLE(10.1) __TVOS_AVAILABLE(10.0.1) __WATCHOS_AVAILABLE(3.1);
156 extern const CFStringRef kSecPolicyAppleWarsaw
157 __OSX_AVAILABLE(10.12.1) __IOS_AVAILABLE(10.1) __TVOS_AVAILABLE(10.0.1) __WATCHOS_AVAILABLE(3.1);
158 extern const CFStringRef kSecPolicyAppleiCloudSetupServerAuth
159 __OSX_AVAILABLE(10.12.4) __IOS_AVAILABLE(10.3) __TVOS_AVAILABLE(10.2) __WATCHOS_AVAILABLE(3.2);
160 extern const CFStringRef kSecPolicyAppleiCloudSetupCompatibilityServerAuth
161 __OSX_AVAILABLE(10.12.4) __IOS_AVAILABLE(10.3) __TVOS_AVAILABLE(10.2) __WATCHOS_AVAILABLE(3.2);
162 extern const CFStringRef kSecPolicyAppleAppTransportSecurity
163 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
164 extern const CFStringRef kSecPolicyAppleMobileSoftwareUpdate
165 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
166 extern const CFStringRef kSecPolicyAppleMobileAssetDevelopment
167 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
168 extern const CFStringRef kSecPolicyAppleMacOSProfileApplicationSigning
169 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
170 extern const CFStringRef kSecPolicyAppleBasicAttestationSystem
171 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
172 extern const CFStringRef kSecPolicyAppleBasicAttestationUser
173 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
174 extern const CFStringRef kSecPolicyAppleiPhoneVPNApplicationSigning
175 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
176
177 /*!
178 @enum Policy Name Constants (Private)
179 @discussion Predefined constants used to specify a SSL Pinning policy.
180 To be used with SecTrustSetPolicyName.
181 @constant kSecPolicyNameAppleAST2Service
182 @constant kSecPolicyNameAppleEscrowProxyService
183 @constant kSecPolicyNameAppleFMiPService
184 @constant kSecPolicyNameAppleGSService
185 @constant kSecPolicyNameAppleHomeKitService
186 @constant kSecPolicyNameAppleiCloudSetupService
187 @constant kSecPolicyNameAppleIDSService
188 @constant kSecPolicyNameAppleMMCSService
189 @constant kSecPolicyNameApplePPQService
190 @constant kSecPolicyNameApplePushService
191 @constant kSecPolicyNameAppleAIDCService
192 @constant kSecPolicyNameAppleMapsService
193 @constant kSecPolicyNameAppleHealthProviderService
194 @constant kSecPolicyNameAppleParsecService
195 */
196 extern const CFStringRef kSecPolicyNameAppleAST2Service
197 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
198 extern const CFStringRef kSecPolicyNameAppleEscrowProxyService
199 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
200 extern const CFStringRef kSecPolicyNameAppleFMiPService
201 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
202 extern const CFStringRef kSecPolicyNameAppleGSService
203 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
204 extern const CFStringRef kSecPolicyNameAppleHomeKitService
205 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
206 extern const CFStringRef kSecPolicyNameAppleiCloudSetupService
207 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
208 extern const CFStringRef kSecPolicyNameAppleIDSService
209 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
210 extern const CFStringRef kSecPolicyNameAppleMMCSService
211 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
212 extern const CFStringRef kSecPolicyNameApplePPQService
213 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
214 extern const CFStringRef kSecPolicyNameApplePushService
215 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
216 extern const CFStringRef kSecPolicyNameAppleAIDCService
217 __OSX_AVAILABLE(10.13.4) __IOS_AVAILABLE(11.3) __TVOS_AVAILABLE(11.3) __WATCHOS_AVAILABLE(4.3);
218 extern const CFStringRef kSecPolicyNameAppleMapsService
219 __OSX_AVAILABLE(10.13.4) __IOS_AVAILABLE(11.3) __TVOS_AVAILABLE(11.3) __WATCHOS_AVAILABLE(4.3);
220 extern const CFStringRef kSecPolicyNameAppleHealthProviderService
221 __OSX_AVAILABLE(10.13.4) __IOS_AVAILABLE(11.3) __TVOS_AVAILABLE(11.3) __WATCHOS_AVAILABLE(4.3);
222 extern const CFStringRef kSecPolicyNameAppleParsecService
223 __OSX_AVAILABLE(10.13.4) __IOS_AVAILABLE(11.3) __TVOS_AVAILABLE(11.3) __WATCHOS_AVAILABLE(4.3);
224
225 /*!
226 @enum Policy Value Constants
227 @abstract Predefined property key constants used to get or set values in
228 a dictionary for a policy instance.
229 @discussion
230 All policies will have the following read-only value:
231 kSecPolicyOid (the policy object identifier)
232
233 Additional policy values which your code can optionally set:
234 kSecPolicyName (name which must be matched)
235 kSecPolicyClient (evaluate for client, rather than server)
236 kSecPolicyRevocationFlags (only valid for a revocation policy)
237 kSecPolicyRevocationFlags (only valid for a revocation policy)
238 kSecPolicyTeamIdentifier (only valid for a Passbook signing policy)
239 kSecPolicyContext (valid for policies below that take a context parameter)
240 kSecPolicyPolicyName (only valid for GenericApplePinned or
241 GenericAppleSSLPinned policies)
242 kSecPolicyIntermediateMarkerOid (only valid for GenericApplePinned or
243 GenericAppleSSLPinned policies)
244 kSecPolicyLeafMarkerOid (only valid for GenericApplePinned or
245 GenericAppleSSLPinned policies)
246 kSecPolicyRootDigest (only valid for the UniqueDeviceCertificate policy)
247
248 @constant kSecPolicyContext Specifies a CFDictionaryRef with keys and values
249 specified by the particular SecPolicyCreate function.
250 @constant kSecPolicyPolicyName Specifies a CFStringRef of the name of the
251 desired policy result.
252 @constant kSecPolicyIntermediateMarkerOid Specifies a CFStringRef of the
253 marker OID (in decimal format) required in the intermediate certificate.
254 @constant kSecPolicyLeafMarkerOid Specifies a CFStringRef of the
255 marker OID (in decimal format) required in the leaf certificate.
256 @constant kSecPolicyRootDigest Specifies a CFDataRef of digest required to
257 match the SHA-256 of the root certificate.
258 */
259 extern const CFStringRef kSecPolicyContext
260 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
261 extern const CFStringRef kSecPolicyPolicyName
262 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
263 extern const CFStringRef kSecPolicyIntermediateMarkerOid
264 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
265 extern const CFStringRef kSecPolicyLeafMarkerOid
266 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
267 extern const CFStringRef kSecPolicyRootDigest
268 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
269
270 /*!
271 @enum Revocation Policy Constants
272 @abstract Predefined constants which allow you to specify how revocation
273 checking will be performed for a trust evaluation.
274 @constant kSecRevocationOnlineCheck If this flag is set, perform an online
275 revocation check, ignoring cached revocation results. This flag will not force
276 an online check if an online check was done within the last 5 minutes. Online
277 checks are only applicable to OCSP; this constant will not force a fresh
278 CRL download.
279 @constant kSecRevocationCheckIfTrusted If this flag is set, perform network-based
280 revocation checks only if the chain has no other validation errors. This flag
281 overrides SecTrustSetNetworkFetchAllowed and kSecRevocationNetworkAccessDisabled
282 for revocation checking (but not for intermediate fetching).
283 Note that this flag's behavior is not default because revoked certs produce Fatal
284 trust results, whereas most checks produce Recoverable trust results. If we skip
285 revocation checks on untrusted chains, the user may be able to ignore the failures
286 of a revoked cert.
287 */
288 CF_ENUM(CFOptionFlags) {
289 kSecRevocationOnlineCheck = (1 << 5),
290 kSecRevocationCheckIfTrusted = (1 << 6),
291 };
292
293 /*!
294 @function SecPolicyCreateApplePinned
295 @abstract Returns a policy object for verifying Apple certificates.
296 @param policyName A string that identifies the policy name.
297 @param intermediateMarkerOID A string containing the decimal representation of the
298 extension OID in the intermediate certificate.
299 @param leafMarkerOID A string containing the decimal representation of the extension OID
300 in the leaf certificate.
301 @discussion The resulting policy uses the Basic X.509 policy with validity check and
302 pinning options:
303 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
304 the chain to be anchored to Test Apple Root CAs if the value true is set for the key
305 "ApplePinningAllowTestCerts%@" (where %@ is the policyName parameter) in the
306 com.apple.security preferences for the user of the calling application.
307 * There are exactly 3 certs in the chain.
308 * The intermediate has a marker extension with OID matching the intermediateMarkerOID
309 parameter.
310 * The leaf has a marker extension with OID matching the leafMarkerOID parameter.
311 * Revocation is checked via any available method.
312 * RSA key sizes are 2048-bit or larger. EC key sizes are P-256 or larger.
313 @result A policy object. The caller is responsible for calling CFRelease on this when
314 it is no longer needed.
315 */
316 __nullable CF_RETURNS_RETAINED
317 SecPolicyRef SecPolicyCreateApplePinned(CFStringRef policyName,
318 CFStringRef intermediateMarkerOID, CFStringRef leafMarkerOID)
319 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
320
321 /*!
322 @function SecPolicyCreateAppleSSLPinned
323 @abstract Returns a policy object for verifying Apple SSL certificates.
324 @param policyName A string that identifies the service/policy name.
325 @param hostname hostname to verify the certificate name against.
326 @param intermediateMarkerOID A string containing the decimal representation of the
327 extension OID in the intermediate certificate. If NULL is passed, the default OID of
328 1.2.840.113635.100.6.2.12 is checked.
329 @param leafMarkerOID A string containing the decimal representation of the extension OID
330 in the leaf certificate.
331 @discussion The resulting policy uses the Basic X.509 policy with validity check and
332 pinning options:
333 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
334 the chain to be anchored to Test Apple Root CAs if the value true is set for the key
335 "ApplePinningAllowTestCerts%@" (where %@ is the policyName parameter) in the
336 com.apple.security preferences for the user of the calling application.
337 * There are exactly 3 certs in the chain.
338 * The intermediate has a marker extension with OID matching the intermediateMarkerOID
339 parameter, or 1.2.840.113635.100.6.2.12 if NULL is passed.
340 * The leaf has a marker extension with OID matching the leafMarkerOID parameter.
341 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
342 extension or Common Name.
343 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
344 * Revocation is checked via any available method.
345 * RSA key sizes are 2048-bit or larger. EC key sizes are P-256 or larger.
346 @result A policy object. The caller is responsible for calling CFRelease on this when
347 it is no longer needed.
348 */
349 __nullable CF_RETURNS_RETAINED
350 SecPolicyRef SecPolicyCreateAppleSSLPinned(CFStringRef policyName, CFStringRef hostname,
351 CFStringRef __nullable intermediateMarkerOID, CFStringRef leafMarkerOID)
352 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
353
354 /*!
355 @function SecPolicyCreateiPhoneActivation
356 @abstract Returns a policy object for verifying iPhone Activation
357 certificate 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 3 certs in chain.
363 * The intermediate has Common Name "Apple iPhone Certification Authority".
364 * The leaf has Common Name "iPhone Activation".
365 @result A policy object. The caller is responsible for calling CFRelease
366 on this when it is no longer needed.
367 */
368 __nullable CF_RETURNS_RETAINED
369 SecPolicyRef SecPolicyCreateiPhoneActivation(void);
370
371 /*!
372 @function SecPolicyCreateiPhoneDeviceCertificate
373 @abstract Returns a policy object for verifying iPhone Device certificate
374 chains.
375 @discussion This policy uses the Basic X.509 policy with no validity check
376 and pinning options:
377 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
378 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
379 * There are exactly 4 certs in chain.
380 * The first intermediate has Common Name "Apple iPhone Device CA".
381 @result A policy object. The caller is responsible for calling CFRelease
382 on this when it is no longer needed.
383 */
384 __nullable CF_RETURNS_RETAINED
385 SecPolicyRef SecPolicyCreateiPhoneDeviceCertificate(void);
386
387 /*!
388 @function SecPolicyCreateFactoryDeviceCertificate
389 @abstract Returns a policy object for verifying Factory Device certificate
390 chains.
391 @discussion This policy uses the Basic X.509 policy with no validity check
392 and pinning options:
393 * The chain is anchored to the Factory Device CA.
394 @result A policy object. The caller is responsible for calling CFRelease
395 on this when it is no longer needed.
396 */
397 __nullable CF_RETURNS_RETAINED
398 SecPolicyRef SecPolicyCreateFactoryDeviceCertificate(void);
399
400 /*!
401 @function SecPolicyCreateiAP
402 @abstract Returns a policy object for verifying iAP certificate chains.
403 @discussion This policy uses the Basic X.509 policy with no validity check
404 and pinning options:
405 * The leaf has notBefore date after 5/31/2006 midnight GMT.
406 * The leaf has Common Name beginning with "IPA_".
407 The intended use of this policy is that the caller pass in the
408 intermediates for iAP1 and iAP2 to SecTrustSetAnchorCertificates().
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 SecPolicyCreateiAP(void);
414
415 /*!
416 @function SecPolicyCreateiTunesStoreURLBag
417 @abstract Returns a policy object for verifying iTunes Store URL bag
418 certificates.
419 @discussion This policy uses the Basic X.509 policy with no validity check
420 and pinning options:
421 * The chain is anchored to the iTMS CA.
422 * There are exactly 2 certs in the chain.
423 * The leaf has Organization "Apple Inc.".
424 * The leaf has Common Name "iTunes Store URL Bag".
425 @result A policy object. The caller is responsible for calling CFRelease
426 on this when it is no longer needed.
427 */
428 __nullable CF_RETURNS_RETAINED
429 SecPolicyRef SecPolicyCreateiTunesStoreURLBag(void);
430
431 /*!
432 @function SecPolicyCreateEAP
433 @abstract Returns a policy object for verifying for 802.1x/EAP certificates.
434 @param server Passing true for this parameter create a policy for EAP
435 server certificates.
436 @param trustedServerNames Optional; if present, the hostname in the leaf
437 certificate must be in the trustedServerNames list. Note that contrary
438 to all other policies the trustedServerNames list entries can have wildcards
439 whilst the certificate cannot. This matches the existing deployments.
440 @discussion This policy uses the Basic X.509 policy with validity check but
441 disallowing network fetching. If trustedServerNames param is non-null, the
442 ExtendedKeyUsage extension, if present, of the leaf certificate is verified
443 to contain either the ServerAuth OID, if the server param is true or
444 ClientAuth OID, otherwise.
445 @result A policy object. The caller is responsible for calling CFRelease
446 on this when it is no longer needed.
447 */
448 __nullable CF_RETURNS_RETAINED
449 SecPolicyRef SecPolicyCreateEAP(Boolean server, CFArrayRef __nullable trustedServerNames);
450
451 /*!
452 @function SecPolicyCreateIPSec
453 @abstract Returns a policy object for evaluating IPSec certificate chains.
454 @param server Passing true for this parameter create a policy for IPSec
455 server certificates.
456 @param hostname Optional; if present, the policy will require the specified
457 hostname or ip address to match the hostname in the leaf certificate.
458 @discussion This policy uses the Basic X.509 policy with validity check.
459 @result A policy object. The caller is responsible for calling CFRelease
460 on this when it is no longer needed.
461 */
462 __nullable CF_RETURNS_RETAINED
463 SecPolicyRef SecPolicyCreateIPSec(Boolean server, CFStringRef __nullable hostname);
464
465 /*!
466 @function SecPolicyCreateAppleSWUpdateSigning
467 @abstract Returns a policy object for evaluating SW update signing certs.
468 @discussion This policy uses the Basic X.509 policy with no validity check
469 and pinning options:
470 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
471 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
472 * There are exactly 3 certs in the chain.
473 * The intermediate ExtendedKeyUsage Extension contains 1.2.840.113635.100.4.1.
474 * The leaf ExtendedKeyUsage extension contains 1.2.840.113635.100.4.1.
475 @result A policy object. The caller is responsible for calling CFRelease
476 on this when it is no longer needed.
477 */
478 __nullable CF_RETURNS_RETAINED
479 SecPolicyRef SecPolicyCreateAppleSWUpdateSigning(void);
480
481 /*!
482 @function SecPolicyCreateApplePackageSigning
483 @abstract Returns a policy object for evaluating installer package signing certs.
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 leaf KeyUsage extension has the digital signature bit set.
490 * The leaf ExtendedKeyUsage extension has the CodeSigning OID.
491 @result A policy object. The caller is responsible for calling CFRelease
492 on this when it is no longer needed.
493 */
494 __nullable CF_RETURNS_RETAINED
495 SecPolicyRef SecPolicyCreateApplePackageSigning(void);
496
497 /*!
498 @function SecPolicyCreateiPhoneApplicationSigning
499 @abstract Returns a policy object for evaluating signed application
500 signatures. This is for apps signed directly by the app store.
501 @discussion This policy uses the Basic X.509 policy with no validity check
502 and pinning options:
503 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
504 the chain to be anchored to Test Apple Root CAs.
505 * There are exactly 3 certs in the chain.
506 * The intermediate has Common Name "Apple iPhone Certification Authority".
507 * The leaf has Common Name "Apple iPhone OS Application Signing".
508 * The leaf has a marker extension with OID 1.2.840.113635.100.6.1.3 or OID
509 1.2.840.113635.100.6.1.6.
510 * The leaf has ExtendedKeyUsage, if any, with the AnyExtendedKeyUsage OID
511 or the CodeSigning OID.
512 @result A policy object. The caller is responsible for calling CFRelease
513 on this when it is no longer needed.
514 */
515 __nullable CF_RETURNS_RETAINED
516 SecPolicyRef SecPolicyCreateiPhoneApplicationSigning(void);
517
518 /*!
519 @function SecPolicyCreateiPhoneVPNApplicationSigning
520 @abstract Returns a policy object for evaluating signed VPN application
521 signatures. This is for VPN plugins signed directly by the VPN team.
522 @discussion This policy uses the Basic X.509 policy with no validity check
523 and pinning options:
524 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
525 the chain to be anchored to Test Apple Root CAs.
526 * There are exactly 3 certs in the chain.
527 * The intermediate has Common Name "Apple iPhone Certification Authority".
528 * The leaf has Common Name "Apple iPhone OS Application Signing".
529 * The leaf has a marker extension with 1.2.840.113635.100.6.1.6.
530 * The leaf has ExtendedKeyUsage, if any, with the AnyExtendedKeyUsage OID
531 or the CodeSigning OID.
532 @result A policy object. The caller is responsible for calling CFRelease
533 on this when it is no longer needed.
534 */
535 __nullable CF_RETURNS_RETAINED
536 SecPolicyRef SecPolicyCreateiPhoneVPNApplicationSigning(void)
537 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
538
539 /*!
540 @function SecPolicyCreateiPhoneProfileApplicationSigning
541 @abstract Returns a policy object for evaluating signed application
542 signatures. This policy is for certificates inside a UPP or regular
543 profile.
544 @discussion This policy uses the Basic X.509 policy with validity check and
545 pinning options:
546 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
547 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
548 * There are exactly 3 certs in the chain.
549 * The intermediate has a marker extension with OID matching 1.2.840.113635.100.6.2.1 (WWDR CA).
550 * The leaf has a marker extension with OID matching one of the following:
551 * 1.2.840.113635.100.6.1.2 ("iPhone Developer" leaf)
552 * 1.2.840.113635.100.6.1.4 ("iPhone Distribution" leaf)
553 * 1.2.840.113635.100.6.1.25.1 ("TestFlight" leaf)
554 * On internal releases, 1.2.840.113635.100.6.1.25.2
555 * The leaf has an ExtendedKeyUsage OID matching 1.3.6.1.5.5.7.3.3 (CodeSigning EKU).
556 * Revocation is checked via any available method.
557 @result A policy object. The caller is responsible for calling CFRelease
558 on this when it is no longer needed.
559 */
560 __nullable CF_RETURNS_RETAINED
561 SecPolicyRef SecPolicyCreateiPhoneProfileApplicationSigning(void);
562
563 /*!
564 @function SecPolicyCreateMacOSProfileApplicationSigning
565 @abstract Returns a policy object for evaluating signed application
566 signatures. This policy is for certificates inside a UPP or regular
567 profile.
568 @discussion This policy uses the Basic X.509 policy with no validity check
569 and pinning options:
570 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
571 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
572 * There are exactly 3 certs in the chain.
573 * The leaf has a marker extension with OID matching one of the following:
574 * 1.2.840.113635.100.6.1.7 ("3rd Party Mac Developer Application" leaf)
575 * 1.2.840.113635.100.6.1.12 ("Mac Developer" leaf)
576 * 1.2.840.113635.100.6.1.13 ("Developer ID Application" leaf)
577 * 1.2.840.113635.100.6.22 ("Software Signing" leaf
578 * The leaf has an ExtendedKeyUsage OID matching 1.3.6.1.5.5.7.3.3 (CodeSigning EKU).
579 * Revocation is checked via any available method.
580 @result A policy object. The caller is responsible for calling CFRelease
581 on this when it is no longer needed.
582 */
583 __nullable CF_RETURNS_RETAINED
584 SecPolicyRef SecPolicyCreateMacOSProfileApplicationSigning(void)
585 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
586
587 /*!
588 @function SecPolicyCreateiPhoneProvisioningProfileSigning
589 @abstract Returns a policy object for evaluating provisioning profile signatures.
590 @discussion This policy uses the Basic X.509 policy with no validity check
591 and pinning options:
592 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
593 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
594 * There are exactly 3 certs in the chain.
595 * The intermediate has Common Name "Apple iPhone Certification Authority".
596 * The leaf has Common Name "Apple iPhone OS Provisioning Profile Signing".
597 * If the device is not a production device and is running an internal
598 release, the leaf may have the Common Name "TEST Apple iPhone OS
599 Provisioning Profile Signing TEST".
600 @result A policy object. The caller is responsible for calling CFRelease
601 on this when it is no longer needed.
602 */
603 __nullable CF_RETURNS_RETAINED
604 SecPolicyRef SecPolicyCreateiPhoneProvisioningProfileSigning(void);
605
606 /*!
607 @function SecPolicyCreateAppleTVOSApplicationSigning
608 @abstract Returns a policy object for evaluating signed application
609 signatures. This is for apps signed directly by the Apple TV app store,
610 and allows for both the prod and the dev/test certs.
611 @discussion This policy uses the Basic X.509 policy with no validity check
612 and pinning options:
613 * The chain is anchored to any of the production Apple Root CAs.
614 Test roots are never permitted.
615 * There are exactly 3 certs in the chain.
616 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.1.
617 * The leaf has ExtendedKeyUsage, if any, with the AnyExtendedKeyUsage OID or
618 the CodeSigning OID.
619 * The leaf has a marker extension with OID 1.2.840.113635.100.6.1.24 or OID
620 1.2.840.113635.100.6.1.24.1.
621 @result A policy object. The caller is responsible for calling CFRelease
622 on this when it is no longer needed.
623 */
624 __nullable CF_RETURNS_RETAINED
625 SecPolicyRef SecPolicyCreateAppleTVOSApplicationSigning(void);
626
627 /*!
628 @function SecPolicyCreateOCSPSigner
629 @abstract Returns a policy object for evaluating ocsp response signers.
630 @discussion This policy uses the Basic X.509 policy with validity check and
631 requires the leaf to have an ExtendedKeyUsage of OCSPSigning.
632 @result A policy object. The caller is responsible for calling CFRelease
633 on this when it is no longer needed.
634 */
635 __nullable CF_RETURNS_RETAINED
636 SecPolicyRef SecPolicyCreateOCSPSigner(void);
637
638
639 enum {
640 kSecSignSMIMEUsage = (1 << 0),
641 kSecKeyEncryptSMIMEUsage = (1 << 1),
642 kSecDataEncryptSMIMEUsage = (1 << 2),
643 kSecKeyExchangeDecryptSMIMEUsage = (1 << 3),
644 kSecKeyExchangeEncryptSMIMEUsage = (1 << 4),
645 kSecKeyExchangeBothSMIMEUsage = (1 << 5),
646 kSecAnyEncryptSMIME = kSecKeyEncryptSMIMEUsage | kSecDataEncryptSMIMEUsage |
647 kSecKeyExchangeDecryptSMIMEUsage | kSecKeyExchangeEncryptSMIMEUsage,
648 kSecIgnoreExpirationSMIMEUsage = (1 << 6)
649 };
650
651 /*!
652 @function SecPolicyCreateSMIME
653 @abstract Returns a policy object for evaluating S/MIME certificate chains.
654 @param smimeUsage Pass the bitwise or of one or more kSecXXXSMIMEUsage
655 flags, to indicate the intended usage of this certificate.
656 @param email Optional; if present, the policy will require the specified
657 email to match the email in the leaf certificate.
658 @discussion This policy uses the Basic X.509 policy with validity check and
659 requires the leaf to have
660 * a KeyUsage matching the smimeUsage,
661 * an ExtendedKeyUsage, if any, with the AnyExtendedKeyUsage OID or the
662 EmailProtection OID, and
663 * if the email param is specified, the email address in the RFC822Name in the
664 SubjectAlternativeName extension or in the Email Address field of the
665 Subject Name.
666 Note that temporal validity checking can be disabled with kSecIgnoreExpirationSMIMEUsage
667 @result A policy object. The caller is responsible for calling CFRelease
668 on this when it is no longer needed.
669 */
670 __nullable CF_RETURNS_RETAINED
671 SecPolicyRef SecPolicyCreateSMIME(CFIndex smimeUsage, CFStringRef __nullable email);
672
673 /*!
674 @function SecPolicyCreateCodeSigning
675 @abstract Returns a policy object for evaluating code signing certificate chains.
676 @discussion This policy uses the Basic X.509 policy with validity check and
677 requires the leaf to have
678 * a KeyUsage with both the DigitalSignature and NonRepudiation bits set, and
679 * an ExtendedKeyUsage with the AnyExtendedKeyUsage OID or the CodeSigning OID.
680 @result A policy object. The caller is responsible for calling CFRelease
681 on this when it is no longer needed.
682 */
683 __nullable CF_RETURNS_RETAINED
684 SecPolicyRef SecPolicyCreateCodeSigning(void);
685
686 /*!
687 @function SecPolicyCreateLockdownPairing
688 @abstract basic x509 policy for checking lockdown pairing certificate chains.
689 @disucssion This policy checks some of the Basic X.509 policy options with no
690 validity check. It explicitly allows for empty subjects.
691 @result A policy object. The caller is responsible for calling CFRelease
692 on this when it is no longer needed.
693 */
694 __nullable CF_RETURNS_RETAINED
695 SecPolicyRef SecPolicyCreateLockdownPairing(void);
696
697 /*!
698 @function SecPolicyCreateURLBag
699 @abstract Returns a policy object for evaluating certificate chains for signing URL bags.
700 @discussion This policy uses the Basic X.509 policy with no validity check and requires
701 that the leaf has ExtendedKeyUsage extension with the CodeSigning OID.
702 @result A policy object. The caller is responsible for calling CFRelease
703 on this when it is no longer needed.
704 */
705 __nullable CF_RETURNS_RETAINED
706 SecPolicyRef SecPolicyCreateURLBag(void);
707
708 /*!
709 @function SecPolicyCreateOTATasking
710 @abstract Returns a policy object for evaluating certificate chains for signing OTA Tasking.
711 @discussion This policy uses the Basic X.509 policy with validity check and
712 pinning options:
713 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
714 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
715 * There are exactly 3 certs in the chain.
716 * The intermediate has Common Name "Apple iPhone Certification Authority".
717 * The leaf has Common Name "OTA Task Signing".
718 @result A policy object. The caller is responsible for calling CFRelease
719 on this when it is no longer needed.
720 */
721 __nullable CF_RETURNS_RETAINED
722 SecPolicyRef SecPolicyCreateOTATasking(void);
723
724 /*!
725 @function SecPolicyCreateMobileAsset
726 @abstract Returns a policy object for evaluating certificate chains for signing Mobile Assets.
727 @discussion This policy uses the Basic X.509 policy with no validity check
728 and pinning options:
729 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
730 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
731 * There are exactly 3 certs in the chain.
732 * The intermediate has Common Name "Apple iPhone Certification Authority".
733 * The leaf has Common Name "Asset Manifest Signing".
734 @result A policy object. The caller is responsible for calling CFRelease
735 on this when it is no longer needed.
736 */
737 __nullable CF_RETURNS_RETAINED
738 SecPolicyRef SecPolicyCreateMobileAsset(void);
739
740 /*!
741 @function SecPolicyCreateMobileAssetDevelopment
742 @abstract Returns a policy object for evaluating certificate chains for signing development
743 Mobile Assets.
744 @discussion This policy uses the Basic X.509 policy with no validity check
745 and pinning options:
746 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
747 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
748 * There are exactly 3 certs in the chain.
749 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.18.
750 * The leaf has a marker extension with OID 1.2.840.113635.100.6.55.1.
751 @result A policy object. The caller is responsible for calling CFRelease
752 on this when it is no longer needed.
753 */
754 __nullable CF_RETURNS_RETAINED
755 SecPolicyRef SecPolicyCreateMobileAssetDevelopment(void)
756 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
757
758 /*!
759 @function SecPolicyCreateAppleIDAuthorityPolicy
760 @abstract Returns a policy object for evaluating certificate chains for Apple ID Authority.
761 @discussion This policy uses the Basic X.509 policy with validity check
762 and pinning options:
763 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
764 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
765 * The intermediate(s) has(have) a marker extension with OID 1.2.840.113635.100.6.2.3
766 or OID 1.2.840.113635.100.6.2.7.
767 * The leaf has a marker extension with OID 1.2.840.113635.100.4.7.
768 * Revocation is checked via any available method.
769 @result A policy object. The caller is responsible for calling CFRelease
770 on this when it is no longer needed.
771 */
772 __nullable CF_RETURNS_RETAINED
773 SecPolicyRef SecPolicyCreateAppleIDAuthorityPolicy(void);
774
775 /*!
776 @function SecPolicyCreateMacAppStoreReceipt
777 @abstract Returns a policy object for evaluating certificate chains for signing
778 Mac App Store Receipts.
779 @discussion This policy uses the Basic X.509 policy with validity check
780 and pinning options:
781 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
782 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
783 * There are exactly 3 certs in the chain.
784 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.1.
785 * The leaf has CertificatePolicy extension with OID 1.2.840.113635.100.5.6.1.
786 * The leaf has a marker extension with OID 1.2.840.113635.100.6.11.1.
787 * Revocation is checked via any available method.
788 @result A policy object. The caller is responsible for calling CFRelease
789 on this when it is no longer needed.
790 */
791 __nullable CF_RETURNS_RETAINED
792 SecPolicyRef SecPolicyCreateMacAppStoreReceipt(void);
793
794 /*!
795 @function SecPolicyCreatePassbookCardSigner
796 @abstract Returns a policy object for evaluating certificate chains for signing Passbook cards.
797 @param cardIssuer Required; must match name in marker extension.
798 @param teamIdentifier Optional; if present, the policy will require the specified
799 team ID to match the organizationalUnit field in the leaf certificate's subject.
800 @discussion This policy uses the Basic X.509 policy with validity check
801 and pinning options:
802 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
803 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
804 * The leaf has a marker extension with OID 1.2.840.113635.100.6.1.16 and containing the
805 cardIssuer.
806 * The leaf has ExtendedKeyUsage with OID 1.2.840.113635.100.4.14.
807 * The leaf has a Organizational Unit matching the TeamID.
808 @result A policy object. The caller is responsible for calling CFRelease
809 on this when it is no longer needed.
810 */
811 __nullable CF_RETURNS_RETAINED
812 SecPolicyRef SecPolicyCreatePassbookCardSigner(CFStringRef cardIssuer,
813 CFStringRef __nullable teamIdentifier);
814
815 /*!
816 @function SecPolicyCreateMobileStoreSigner
817 @abstract Returns a policy object for evaluating Mobile Store certificate chains.
818 @discussion This policy uses the Basic X.509 policy with validity check
819 and pinning options:
820 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
821 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
822 * There are exactly 3 certs in the chain.
823 * The intermediate has Common Name "Apple System Integration 2 Certification Authority".
824 * The leaf has KeyUsage with the DigitalSignature bit set.
825 * The leaf has CertificatePolicy extension with OID 1.2.840.113635.100.5.12.
826 @result A policy object. The caller is responsible for calling CFRelease
827 on this when it is no longer needed.
828 */
829 __nullable CF_RETURNS_RETAINED
830 SecPolicyRef SecPolicyCreateMobileStoreSigner(void);
831
832 /*!
833 @function SecPolicyCreateTestMobileStoreSigner
834 @abstract Returns a policy object for evaluating Test Mobile Store certificate chains.
835 @discussion This policy uses the Basic X.509 policy with validity check
836 and pinning options:
837 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
838 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
839 * There are exactly 3 certs in the chain.
840 * The intermediate has Common Name "Apple System Integration 2 Certification Authority".
841 * The leaf has KeyUsage with the DigitalSignature bit set.
842 * The leaf has CertificatePolicy extension with OID 1.2.840.113635.100.5.12.1.
843 @result A policy object. The caller is responsible for calling CFRelease
844 on this when it is no longer needed.
845 */
846 __nullable CF_RETURNS_RETAINED
847 SecPolicyRef SecPolicyCreateTestMobileStoreSigner(void);
848
849 /*!
850 @function SecPolicyCreateEscrowServiceSigner
851 @abstract Returns a policy object for evaluating Escrow Service certificate chains.
852 @discussion This policy uses the Basic X.509 policy with no validity check
853 and pinning options:
854 * The chain is anchored to the current Escrow Roots in the OTAPKI asset.
855 * There are exactly 2 certs in the chain.
856 * The leaf has KeyUsage with the KeyEncipherment bit set.
857 @result A policy object. The caller is responsible for calling CFRelease
858 on this when it is no longer needed.
859 */
860 __nullable CF_RETURNS_RETAINED
861 SecPolicyRef SecPolicyCreateEscrowServiceSigner(void);
862
863 /*!
864 @function SecPolicyCreatePCSEscrowServiceSigner
865 @abstract Returns a policy object for evaluating PCS Escrow Service certificate chains.
866 @discussion This policy uses the Basic X.509 policy with validity check
867 and pinning options:
868 * The chain is anchored to the current PCS Escrow Roots in the OTAPKI asset.
869 * There are exactly 2 certs in the chain.
870 * The leaf has KeyUsage with the KeyEncipherment bit set.
871 @result A policy object. The caller is responsible for calling CFRelease
872 on this when it is no longer needed.
873 */
874 __nullable CF_RETURNS_RETAINED
875 SecPolicyRef SecPolicyCreatePCSEscrowServiceSigner(void);
876
877 /*!
878 @function SecPolicyCreateOSXProvisioningProfileSigning
879 @abstract Returns a policy object for evaluating certificate chains for signing OS X
880 Provisioning Profiles.
881 @discussion This policy uses the Basic X.509 policy with validity check
882 and pinning options:
883 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
884 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
885 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.1.
886 * The leaf has KeyUsage with the DigitalSignature bit set.
887 * The leaf has a marker extension with OID 1.2.840.113635.100.4.11.
888 * Revocation is checked via OCSP.
889 @result A policy object. The caller is responsible for calling CFRelease
890 on this when it is no longer needed.
891 */
892 __nullable CF_RETURNS_RETAINED
893 SecPolicyRef SecPolicyCreateOSXProvisioningProfileSigning(void);
894
895 /*!
896 @function SecPolicyCreateConfigurationProfileSigner
897 @abstract Returns a policy object for evaluating certificate chains for signing
898 Configuration Profiles.
899 @discussion This policy uses the Basic X.509 policy with validity check
900 and pinning options:
901 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
902 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
903 * There are exactly 3 certs in the chain.
904 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.3.
905 * The leaf has ExtendedKeyUsage with OID 1.2.840.113635.100.4.16.
906 @result A policy object. The caller is responsible for calling CFRelease
907 on this when it is no longer needed.
908 */
909 __nullable CF_RETURNS_RETAINED
910 SecPolicyRef SecPolicyCreateConfigurationProfileSigner(void);
911
912 /*!
913 @function SecPolicyCreateQAConfigurationProfileSigner
914 @abstract Returns a policy object for evaluating certificate chains for signing
915 QA Configuration Profiles. On customer builds, this function returns the same
916 policy as SecPolicyCreateConfigurationProfileSigner.
917 @discussion This policy uses the Basic X.509 policy with 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 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.3.
922 * The leaf has ExtendedKeyUsage with OID 1.2.840.113635.100.4.17.
923 @result A policy object. The caller is responsible for calling CFRelease
924 on this when it is no longer needed.
925 */
926 __nullable CF_RETURNS_RETAINED
927 SecPolicyRef SecPolicyCreateQAConfigurationProfileSigner(void);
928
929 /*!
930 @function SecPolicyCreateOTAPKISigner
931 @abstract Returns a policy object for evaluating OTA PKI certificate chains.
932 @discussion This policy uses the Basic X.509 policy with validity check
933 and pinning options:
934 * The chain is anchored to Apple PKI Settings CA.
935 * There are exactly 2 certs in the chain.
936 @result A policy object. The caller is responsible for calling CFRelease
937 on this when it is no longer needed.
938 */
939 __nullable CF_RETURNS_RETAINED
940 SecPolicyRef SecPolicyCreateOTAPKISigner(void)
941 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_12, __MAC_10_13_4, __IPHONE_7_0, __IPHONE_11_3);
942
943 /*!
944 @function SecPolicyCreateTestOTAPKISigner
945 @abstract Returns a policy object for evaluating OTA PKI certificate chains.
946 @discussion This policy uses the Basic X.509 policy with validity check
947 and pinning options:
948 * The chain is anchored to Apple Test PKI Settings CA.
949 * There are exactly 2 certs in the chain.
950 @result A policy object. The caller is responsible for calling CFRelease
951 on this when it is no longer needed.
952 */
953 __nullable CF_RETURNS_RETAINED
954 SecPolicyRef SecPolicyCreateTestOTAPKISigner(void)
955 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_12, __MAC_10_13_4, __IPHONE_7_0, __IPHONE_11_3);
956
957 /*!
958 @function SecPolicyCreateAppleIDValidationRecordSigningPolicy
959 @abstract Returns a policy object for evaluating certificate chains for signing
960 Apple ID Validation Records.
961 @discussion This policy uses the Basic X.509 policy with validity check
962 and pinning options:
963 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
964 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
965 * The intermediate(s) has(have) a marker extension with OID 1.2.840.113635.100.6.2.3
966 or OID 1.2.840.113635.100.6.2.10.
967 * The leaf has a marker extension with OID 1.2.840.113635.100.6.25.
968 * Revocation is checked via OCSP.
969 @result A policy object. The caller is responsible for calling CFRelease
970 on this when it is no longer needed.
971 */
972 __nullable CF_RETURNS_RETAINED
973 SecPolicyRef SecPolicyCreateAppleIDValidationRecordSigningPolicy(void);
974
975 /*!
976 @function SecPolicyCreateAppleSMPEncryption
977 @abstract Returns a policy object for evaluating SMP certificate chains.
978 @discussion This policy uses the Basic X.509 policy with no validity check
979 and pinning options:
980 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
981 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
982 * There are exactly 3 certs in the chain.
983 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.13.
984 * The leaf has KeyUsage with the KeyEncipherment bit set.
985 * The leaf has a marker extension with OID 1.2.840.113635.100.6.30.
986 * Revocation is checked via OCSP.
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 SecPolicyCreateAppleSMPEncryption(void);
992
993 /*!
994 @function SecPolicyCreateTestAppleSMPEncryption
995 @abstract Returns a policy object for evaluating Test SMP certificate chains.
996 @discussion This policy uses the Basic X.509 policy with no validity check
997 and pinning options:
998 * The chain is anchored to a Test Apple Root with ECC public key certificate.
999 * There are exactly 3 certs in the chain.
1000 * The intermediate has Common Name "Test Apple System Integration CA - ECC".
1001 * The leaf has KeyUsage with the KeyEncipherment bit set.
1002 * Revocation is checked via OCSP.
1003 @result A policy object. The caller is responsible for calling CFRelease
1004 on this when it is no longer needed.
1005 */
1006 __nullable CF_RETURNS_RETAINED
1007 SecPolicyRef SecPolicyCreateTestAppleSMPEncryption(void);
1008
1009 /*!
1010 @function SecPolicyCreateApplePPQSigning
1011 @abstract Returns a policy object for verifying production PPQ Signing certificates.
1012 @discussion This policy uses the Basic X.509 policy with no validity check
1013 and pinning options:
1014 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
1015 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
1016 * There are exactly 3 certs in the chain.
1017 * The intermediate has Common Name "Apple System Integration 2 Certification
1018 Authority".
1019 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.10.
1020 * The leaf has KeyUsage with the DigitalSignature bit set.
1021 * The leaf has a marker extension with OID 1.2.840.113635.100.6.38.2.
1022 @result A policy object. The caller is responsible for calling CFRelease
1023 on this when it is no longer needed.
1024 */
1025 __nullable CF_RETURNS_RETAINED
1026 SecPolicyRef SecPolicyCreateApplePPQSigning(void);
1027
1028 /*!
1029 @function SecPolicyCreateTestApplePPQSigning
1030 @abstract Returns a policy object for verifying test PPQ Signing certificates. On
1031 customer builds, this function returns the same policy as SecPolicyCreateApplePPQSigning.
1032 @discussion This policy uses the Basic X.509 policy with no validity check
1033 and pinning options:
1034 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
1035 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
1036 * There are exactly 3 certs in the chain.
1037 * The intermediate has Common Name "Apple System Integration 2 Certification
1038 Authority".
1039 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.10.
1040 * The leaf has KeyUsage with the DigitalSignature bit set.
1041 * The leaf has a marker extension with OID 1.2.840.113635.100.6.38.1.
1042 @result A policy object. The caller is responsible for calling CFRelease
1043 on this when it is no longer needed.
1044 */
1045 __nullable CF_RETURNS_RETAINED
1046 SecPolicyRef SecPolicyCreateTestApplePPQSigning(void);
1047
1048 /*!
1049 @function SecPolicyCreateAppleIDSService
1050 @abstract Ensure we're appropriately pinned to the IDS service (SSL + Apple restrictions)
1051 @discussion This policy uses the SSL server policy.
1052 @result A policy object. The caller is responsible for calling CFRelease
1053 on this when it is no longer needed.
1054 */
1055 __nullable CF_RETURNS_RETAINED
1056 SecPolicyRef SecPolicyCreateAppleIDSService(CFStringRef __nullable hostname);
1057
1058 /*!
1059 @function SecPolicyCreateAppleIDSServiceContext
1060 @abstract Ensure we're appropriately pinned to the IDS service (SSL + Apple restrictions)
1061 @param hostname Required; hostname to verify the certificate name against.
1062 @param context Optional; if present, "AppleServerAuthenticationAllowUATIDS" with value
1063 Boolean true will allow Test Apple roots on internal releases.
1064 @discussion This policy uses the Basic X.509 policy with validity check
1065 and pinning options:
1066 * The chain is anchored to any of the production Apple Root CAs. Test Apple Root CAs
1067 are permitted only on internal releases either using the context dictionary or with
1068 defaults write.
1069 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1070 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.4.2 or,
1071 if Test Roots are allowed, OID 1.2.840.113635.100.6.27.4.1.
1072 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1073 extension or Common Name.
1074 * The leaf is checked against the Black and Gray lists.
1075 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1076 * Revocation is checked via any available method.
1077 @result A policy object. The caller is responsible for calling CFRelease
1078 on this when it is no longer needed.
1079 */
1080 __nullable CF_RETURNS_RETAINED
1081 SecPolicyRef SecPolicyCreateAppleIDSServiceContext(CFStringRef hostname, CFDictionaryRef __nullable context);
1082
1083 /*!
1084 @function SecPolicyCreateApplePushService
1085 @abstract Ensure we're appropriately pinned to the Apple Push service (SSL + Apple restrictions)
1086 @param hostname Required; hostname to verify the certificate name against.
1087 @param context Optional; if present, "AppleServerAuthenticationAllowUATAPN" with value
1088 Boolean true will allow Test Apple roots on internal releases.
1089 @discussion This policy uses the Basic X.509 policy with validity check
1090 and pinning options:
1091 * The chain is anchored to any of the production Apple Root CAs. Test Apple Root CAs
1092 are permitted only on internal releases either using the context dictionary or with
1093 defaults write.
1094 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1095 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.5.2 or,
1096 if Test Roots are allowed, OID 1.2.840.113635.100.6.27.5.1.
1097 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1098 extension or Common Name.
1099 * The leaf is checked against the Black and Gray lists.
1100 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1101 * Revocation is checked via any available method.
1102 @result A policy object. The caller is responsible for calling CFRelease
1103 on this when it is no longer needed.
1104 */
1105 __nullable CF_RETURNS_RETAINED
1106 SecPolicyRef SecPolicyCreateApplePushService(CFStringRef hostname, CFDictionaryRef __nullable context);
1107
1108 /*!
1109 @function SecPolicyCreateApplePushServiceLegacy
1110 @abstract Ensure we're appropriately pinned to the Push service (via Entrust)
1111 @param hostname Required; hostname to verify the certificate name against.
1112 @discussion This policy uses the Basic X.509 policy with validity check
1113 and pinning options:
1114 * The chain is anchored to an Entrust Intermediate.
1115 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1116 extension or Common Name.
1117 * The leaf is checked against the Black and Gray lists.
1118 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1119 * Revocation is checked via any available method.
1120 @result A policy object. The caller is responsible for calling CFRelease
1121 on this when it is no longer needed.
1122 */
1123 __nullable CF_RETURNS_RETAINED
1124 SecPolicyRef SecPolicyCreateApplePushServiceLegacy(CFStringRef hostname);
1125
1126 /*!
1127 @function SecPolicyCreateAppleMMCSService
1128 @abstract Ensure we're appropriately pinned to the MMCS service (SSL + Apple restrictions)
1129 @param hostname Required; hostname to verify the certificate name against.
1130 @param context Optional; if present, "AppleServerAuthenticationAllowUATMMCS" with value
1131 Boolean true will allow Test Apple roots and test OIDs 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.
1135 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1136 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.11.2 or, if
1137 enabled, OID 1.2.840.113635.100.6.27.11.1.
1138 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1139 extension or Common Name.
1140 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1141 * Revocation is checked via any available method.
1142 @result A policy object. The caller is responsible for calling CFRelease
1143 on this when it is no longer needed.
1144 */
1145 __nullable CF_RETURNS_RETAINED
1146 SecPolicyRef SecPolicyCreateAppleMMCSService(CFStringRef hostname, CFDictionaryRef __nullable context);
1147
1148 /*!
1149 @function SecPolicyCreateAppleCompatibilityMMCSService
1150 @abstract Ensure we're appropriately pinned to the MMCS service using compatibility certs
1151 @param hostname Required; hostname to verify the certificate name against.
1152 @discussion This policy uses the Basic X.509 policy with validity check
1153 and pinning options:
1154 * The chain is anchored to the GeoTrust Global CA
1155 * The intermediate has a subject public key info hash matching the public key of
1156 the Apple IST CA G1 intermediate.
1157 * The chain length is 3.
1158 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.11.2 or
1159 OID 1.2.840.113635.100.6.27.11.1.
1160 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1161 extension or Common Name.
1162 * The leaf is checked against the Black and Gray lists.
1163 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1164 @result A policy object. The caller is responsible for calling CFRelease
1165 on this when it is no longer needed.
1166 */
1167 __nullable CF_RETURNS_RETAINED
1168 SecPolicyRef SecPolicyCreateAppleCompatibilityMMCSService(CFStringRef hostname)
1169 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
1170
1171 /*!
1172 @function SecPolicyCreateAppleGSService
1173 @abstract Ensure we're appropriately pinned to the GS service (SSL + Apple restrictions)
1174 @param hostname Required; hostname to verify the certificate name against.
1175 @param context Optional; if present, "AppleServerAuthenticationAllowUATGS" with value
1176 Boolean true will allow Test Apple roots on internal releases.
1177 @discussion This policy uses the Basic X.509 policy with validity check
1178 and pinning options:
1179 * The chain is anchored to any of the production Apple Root CAs. Test Apple Root CAs
1180 are permitted only on internal releases either using the context dictionary or with
1181 defaults write.
1182 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1183 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.2.
1184 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1185 extension or Common Name.
1186 * The leaf is checked against the Black and Gray lists.
1187 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1188 * Revocation is checked via any available method.
1189 @result A policy object. The caller is responsible for calling CFRelease
1190 on this when it is no longer needed.
1191 */
1192 __nullable CF_RETURNS_RETAINED
1193 SecPolicyRef SecPolicyCreateAppleGSService(CFStringRef hostname, CFDictionaryRef __nullable context)
1194 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
1195
1196 /*!
1197 @function SecPolicyCreateApplePPQService
1198 @abstract Ensure we're appropriately pinned to the PPQ service (SSL + Apple restrictions)
1199 @param hostname Required; hostname to verify the certificate name against.
1200 @param context Optional; if present, "AppleServerAuthenticationAllowUATPPQ" with value
1201 Boolean true will allow Test Apple roots on internal releases.
1202 @discussion This policy uses the Basic X.509 policy with validity check
1203 and pinning options:
1204 * The chain is anchored to any of the production Apple Root CAs. Test Apple Root CAs
1205 are permitted only on internal releases either using the context dictionary or with
1206 defaults write.
1207 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1208 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.3.2 or,
1209 if Test Roots are allowed, OID 1.2.840.113635.100.6.27.3.1.
1210 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1211 extension or Common Name.
1212 * The leaf is checked against the Black and Gray lists.
1213 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1214 * Revocation is checked via any available method.
1215 @result A policy object. The caller is responsible for calling CFRelease
1216 on this when it is no longer needed.
1217 */
1218 __nullable CF_RETURNS_RETAINED
1219 SecPolicyRef SecPolicyCreateApplePPQService(CFStringRef hostname, CFDictionaryRef __nullable context)
1220 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
1221
1222 /*!
1223 @function SecPolicyCreateAppleAST2Service
1224 @abstract Ensure we're appropriately pinned to the AST2 Diagnostic service (SSL + Apple restrictions)
1225 @param hostname Required; hostname to verify the certificate name against.
1226 @param context Optional; if present, "AppleServerAuthenticationAllowUATAST2" with value
1227 Boolean true will allow Test Apple roots on internal releases.
1228 @discussion This policy uses the Basic X.509 policy with validity check
1229 and pinning options:
1230 * The chain is anchored to any of the production Apple Root CAs. Test Apple Root CAs
1231 are permitted either using the context dictionary or with defaults write.
1232 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1233 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.8.2 or,
1234 if Test Roots are allowed, OID 1.2.840.113635.100.6.27.8.1.
1235 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1236 extension or Common Name.
1237 * The leaf is checked against the Black and Gray lists.
1238 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1239 * Revocation is checked via any available method.
1240 @result A policy object. The caller is responsible for calling CFRelease
1241 on this when it is no longer needed.
1242 */
1243 __nullable CF_RETURNS_RETAINED
1244 SecPolicyRef SecPolicyCreateAppleAST2Service(CFStringRef hostname, CFDictionaryRef __nullable context)
1245 __OSX_AVAILABLE_STARTING(__MAC_10_11_4, __IPHONE_9_3);
1246
1247 /*!
1248 @function SecPolicyCreateAppleEscrowProxyService
1249 @abstract Ensure we're appropriately pinned to the iCloud Escrow Proxy service (SSL + Apple restrictions)
1250 @param hostname Required; hostname to verify the certificate name against.
1251 @param context Optional; if present, "AppleServerAuthenticationAllowUATEscrow" with value
1252 Boolean true will allow Test Apple roots on internal releases.
1253 @discussion This policy uses the Basic X.509 policy with validity check
1254 and pinning options:
1255 * The chain is anchored to any of the production Apple Root CAs via full certificate
1256 comparison. Test Apple Root CAs are permitted only on internal releases either
1257 using the context dictionary or with defaults write.
1258 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1259 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.7.2 or,
1260 if Test Roots are allowed, OID 1.2.840.113635.100.6.27.7.1.
1261 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1262 extension or Common Name.
1263 * The leaf is checked against the Black and Gray lists.
1264 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1265 * Revocation is checked via any available method.
1266 @result A policy object. The caller is responsible for calling CFRelease
1267 on this when it is no longer needed.
1268 */
1269 __nullable CF_RETURNS_RETAINED
1270 SecPolicyRef SecPolicyCreateAppleEscrowProxyService(CFStringRef hostname, CFDictionaryRef __nullable context)
1271 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
1272
1273 /*!
1274 @function SecPolicyCreateAppleCompatibilityEscrowProxyService
1275 @abstract Ensure we're appropriately pinned to the iCloud Escrow Proxy service using compatibility certs
1276 @param hostname Required; hostname to verify the certificate name against.
1277 @discussion This policy uses the Basic X.509 policy with validity check
1278 and pinning options:
1279 * The chain is anchored to the GeoTrust Global CA
1280 * The intermediate has a subject public key info hash matching the public key of
1281 the Apple IST CA G1 intermediate.
1282 * The chain length is 3.
1283 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.7.2 or,
1284 if UAT is enabled with a defaults write (internal devices only),
1285 OID 1.2.840.113635.100.6.27.7.1.
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 @result A policy object. The caller is responsible for calling CFRelease
1291 on this when it is no longer needed.
1292 */
1293 __nullable CF_RETURNS_RETAINED
1294 SecPolicyRef SecPolicyCreateAppleCompatibilityEscrowProxyService(CFStringRef hostname)
1295 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
1296
1297 /*!
1298 @function SecPolicyCreateAppleFMiPService
1299 @abstract Ensure we're appropriately pinned to the Find My iPhone service (SSL + Apple restrictions)
1300 @param hostname Required; hostname to verify the certificate name against.
1301 @param context Optional; if present, "AppleServerAuthenticationAllowUATFMiP" with value
1302 Boolean true will allow Test Apple roots on internal releases.
1303 @discussion This policy uses the Basic X.509 policy with validity check
1304 and pinning options:
1305 * The chain is anchored to any of the production Apple Root CAs via full certificate
1306 comparison. Test Apple Root CAs are permitted only on internal releases either
1307 using the context dictionary or with defaults write.
1308 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1309 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.6.2 or,
1310 if Test Roots are allowed, OID 1.2.840.113635.100.6.27.6.1.
1311 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1312 extension or Common Name.
1313 * The leaf is checked against the Black and Gray lists.
1314 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1315 * Revocation is checked via any available method.
1316 @result A policy object. The caller is responsible for calling CFRelease
1317 on this when it is no longer needed.
1318 */
1319 __nullable CF_RETURNS_RETAINED
1320 SecPolicyRef SecPolicyCreateAppleFMiPService(CFStringRef hostname, CFDictionaryRef __nullable context)
1321 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0);
1322
1323 /*!
1324 @function SecPolicyCreateAppleSSLService
1325 @abstract Ensure we're appropriately pinned to an Apple server (SSL + Apple restrictions)
1326 @param hostname Optional; hostname to verify the certificate name against.
1327 @discussion This policy uses the Basic X.509 policy with validity check
1328 and pinning options:
1329 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
1330 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
1331 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1332 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.1
1333 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1334 extension or Common Name.
1335 * The leaf is checked against the Black and Gray lists.
1336 * The leaf has ExtendedKeyUsage, if any, with the ServerAuth OID.
1337 * Revocation is checked via any available method.
1338 @result A policy object. The caller is responsible for calling CFRelease
1339 on this when it is no longer needed.
1340 */
1341 __nullable CF_RETURNS_RETAINED
1342 SecPolicyRef SecPolicyCreateAppleSSLService(CFStringRef __nullable hostname);
1343
1344 /*!
1345 @function SecPolicyCreateAppleTimeStamping
1346 @abstract Returns a policy object for evaluating time stamping certificate chains.
1347 @discussion This policy uses the Basic X.509 policy with validity check
1348 and requires the leaf has ExtendedKeyUsage with the TimeStamping OID.
1349 @result A policy object. The caller is responsible for calling CFRelease
1350 on this when it is no longer needed.
1351 */
1352 __nullable CF_RETURNS_RETAINED
1353 SecPolicyRef SecPolicyCreateAppleTimeStamping(void);
1354
1355 /*!
1356 @function SecPolicyCreateApplePayIssuerEncryption
1357 @abstract Returns a policy object for evaluating Apple Pay Issuer Encryption certificate chains.
1358 @discussion This policy uses the Basic X.509 policy with no validity check
1359 and pinning options:
1360 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
1361 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
1362 * There are exactly 3 certs in the chain.
1363 * The intermediate has Common Name "Apple Worldwide Developer Relations CA - G2".
1364 * The leaf has KeyUsage with the KeyEncipherment bit set.
1365 * The leaf has a marker extension with OID 1.2.840.113635.100.6.39.
1366 @result A policy object. The caller is responsible for calling CFRelease
1367 on this when it is no longer needed.
1368 */
1369 __nullable CF_RETURNS_RETAINED
1370 SecPolicyRef SecPolicyCreateApplePayIssuerEncryption(void)
1371 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
1372
1373 /*!
1374 @function SecPolicyCreateAppleATVVPNProfileSigning
1375 @abstract Returns a policy object for evaluating Apple TV VPN Profile certificate chains.
1376 @discussion This policy uses the Basic X.509 policy with no validity check
1377 and pinning options:
1378 * The chain is anchored to any of the production Apple Root CAs. Test Apple Root CAs
1379 are permitted only on internal releases.
1380 * There are exactly 3 certs in the chain.
1381 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.10.
1382 * The leaf has a marker extension with OID 1.2.840.113635.100.6.43.
1383 * Revocation is checked via OCSP.
1384 @result A policy object. The caller is responsible for calling CFRelease
1385 on this when it is no longer needed.
1386 */
1387 __nullable CF_RETURNS_RETAINED
1388 SecPolicyRef SecPolicyCreateAppleATVVPNProfileSigning(void)
1389 __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
1390
1391 /*!
1392 @function SecPolicyCreateAppleHomeKitServerAuth
1393 @abstract Ensure we're appropriately pinned to the HomeKit service (SSL + Apple restrictions)
1394 @param hostname Required; hostname to verify the certificate name against.
1395 @discussion This policy uses the Basic X.509 policy with validity check
1396 and pinning options:
1397 * The chain is anchored to any of the production Apple Root CAs via full certificate
1398 comparison. Test Apple Root CAs are permitted only on internal releases with defaults write.
1399 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.16
1400 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.9.
1401 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1402 extension or Common Name.
1403 * The leaf is checked against the Black and Gray lists.
1404 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1405 * Revocation is checked via any available method.
1406 @result A policy object. The caller is responsible for calling CFRelease
1407 on this when it is no longer needed.
1408 */
1409 __nullable CF_RETURNS_RETAINED
1410 SecPolicyRef SecPolicyCreateAppleHomeKitServerAuth(CFStringRef hostname)
1411 __OSX_AVAILABLE_STARTING(__MAC_10_11_4, __IPHONE_9_3);
1412
1413 /*!
1414 @function SecPolicyCreateAppleExternalDeveloper
1415 @abstract Returns a policy object for verifying Apple-issued external developer
1416 certificates.
1417 @discussion The resulting policy uses the Basic X.509 policy with validity check and
1418 pinning options:
1419 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
1420 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
1421 * There are exactly 3 certs in the chain.
1422 * The intermediate has a marker extension with OID matching 1.2.840.113635.100.6.2.1
1423 (WWDR CA) or 1.2.840.113635.100.6.2.6 (Developer ID CA).
1424 * The leaf has a marker extension with OID matching one of the following:
1425 * 1.2.840.113635.100.6.1.2 ("iPhone Developer" leaf)
1426 * 1.2.840.113635.100.6.1.4 ("iPhone Distribution" leaf)
1427 * 1.2.840.113635.100.6.1.5 ("Safari Developer" leaf)
1428 * 1.2.840.113635.100.6.1.7 ("3rd Party Mac Developer Application" leaf)
1429 * 1.2.840.113635.100.6.1.8 ("3rd Party Mac Developer Installer" leaf)
1430 * 1.2.840.113635.100.6.1.12 ("Mac Developer" leaf)
1431 * 1.2.840.113635.100.6.1.13 ("Developer ID Application" leaf)
1432 * 1.2.840.113635.100.6.1.14 ("Developer ID Installer" leaf)
1433 * The leaf has an ExtendedKeyUsage OID matching one of the following:
1434 * 1.3.6.1.5.5.7.3.3 (CodeSigning EKU)
1435 * 1.2.840.113635.100.4.8 ("Safari Developer" EKU)
1436 * 1.2.840.113635.100.4.9 ("3rd Party Mac Developer Installer" EKU)
1437 * 1.2.840.113635.100.4.13 ("Developer ID Installer" EKU)
1438 * Revocation is checked via any available method.
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 SecPolicyCreateAppleExternalDeveloper(void)
1445 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
1446
1447 /*!
1448 @function SecPolicyCreateAppleSoftwareSigning
1449 @abstract Returns a policy object for verifying the Apple Software Signing certificate.
1450 @discussion The resulting policy uses the Basic X.509 policy with no validity check and
1451 pinning options:
1452 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
1453 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
1454 * There are exactly 3 certs in the chain.
1455 * The intermediate has the Common Name "Apple Code Signing Certification Authority".
1456 * The leaf has a marker extension with OID matching 1.2.840.113635.100.6.22.
1457 * The leaf has an ExtendedKeyUsage OID matching 1.3.6.1.5.5.7.3.3 (Code Signing).
1458 * Revocation is checked via any available method.
1459 * RSA key sizes are 2048-bit or larger. EC key sizes are P-256 or larger.
1460 @result A policy object. The caller is responsible for calling CFRelease on this when
1461 it is no longer needed.
1462 */
1463 __nullable CF_RETURNS_RETAINED
1464 SecPolicyRef SecPolicyCreateAppleSoftwareSigning(void)
1465 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
1466
1467 /*!
1468 @function SecPolicyGetName
1469 @abstract Returns a policy's name.
1470 @param policy A policy reference.
1471 @result A policy name.
1472 */
1473 __nullable CFStringRef SecPolicyGetName(SecPolicyRef policy)
1474 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
1475
1476 /*!
1477 @function SecPolicyGetOidString
1478 @abstract Returns a policy's oid in string decimal format.
1479 @param policy A policy reference.
1480 @result A policy oid.
1481 */
1482 CFStringRef SecPolicyGetOidString(SecPolicyRef policy)
1483 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
1484
1485 /*!
1486 @function SecPolicyCreateAppleUniqueDeviceCertificate
1487 @abstract Returns a policy object for verifying Unique Device Identifier Certificates.
1488 @param testRootHash Optional; The SHA-256 fingerprint of a test root for pinning.
1489 @discussion The resulting policy uses the Basic X.509 policy with no validity check and
1490 pinning options:
1491 * The chain is anchored to the SEP Root CA. Internal releases allow the chain to be
1492 anchored to the testRootHash input if the value true is set for the key
1493 "ApplePinningAllowTestCertsUCRT" in the com.apple.security preferences for the user
1494 of the calling application.
1495 * There are exactly 3 certs in the chain.
1496 * The intermediate has an extension with OID matching 1.2.840.113635.100.6.44 and value
1497 of "ucrt".
1498 * The leaf has a marker extension with OID matching 1.2.840.113635.100.10.1.
1499 * RSA key sizes are disallowed. EC key sizes are P-256 or larger.
1500 @result A policy object. The caller is responsible for calling CFRelease on this when
1501 it is no longer needed.
1502 */
1503 __nullable CF_RETURNS_RETAINED
1504 SecPolicyRef SecPolicyCreateAppleUniqueDeviceCertificate(CFDataRef __nullable testRootHash)
1505 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
1506
1507 /*!
1508 @function SecPolicyCreateAppleWarsaw
1509 @abstract Returns a policy object for verifying signed Warsaw assets.
1510 @discussion The resulting policy uses the Basic X.509 policy with validity check and
1511 pinning options:
1512 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
1513 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
1514 * There are exactly 3 certs in the chain.
1515 * The intermediate has an extension with OID matching 1.2.840.113635.100.6.2.14.
1516 * The leaf has a marker extension with OID matching 1.2.840.113635.100.6.29.
1517 * RSA key sizes are 2048-bit or larger. EC key sizes are P-256 or larger.
1518 @result A policy object. The caller is responsible for calling CFRelease on this when
1519 it is no longer needed.
1520 */
1521 __nullable CF_RETURNS_RETAINED
1522 SecPolicyRef SecPolicyCreateAppleWarsaw(void)
1523 __OSX_AVAILABLE(10.12.1) __IOS_AVAILABLE(10.1) __TVOS_AVAILABLE(10.0.1) __WATCHOS_AVAILABLE(3.1);
1524
1525 /*!
1526 @function SecPolicyCreateAppleSecureIOStaticAsset
1527 @abstract Returns a policy object for verifying signed static assets for Secure IO.
1528 @discussion The resulting policy uses the Basic X.509 policy with no validity check and
1529 pinning options:
1530 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
1531 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
1532 * There are exactly 3 certs in the chain.
1533 * The intermediate has an extension with OID matching 1.2.840.113635.100.6.2.10.
1534 * The leaf has a marker extension with OID matching 1.2.840.113635.100.6.50.
1535 * RSA key sizes are 2048-bit or larger. EC key sizes are P-256 or larger.
1536 @result A policy object. The caller is responsible for calling CFRelease on this when
1537 it is no longer needed.
1538 */
1539 __nullable CF_RETURNS_RETAINED
1540 SecPolicyRef SecPolicyCreateAppleSecureIOStaticAsset(void)
1541 __OSX_AVAILABLE(10.12.1) __IOS_AVAILABLE(10.1) __TVOS_AVAILABLE(10.0.1) __WATCHOS_AVAILABLE(3.1);
1542
1543 /*!
1544 @function SecPolicyCreateAppleiCloudSetupService
1545 @abstract Ensure we're appropriately pinned to the iCloud Setup service (SSL + Apple restrictions)
1546 @param hostname Required; hostname to verify the certificate name against.
1547 @param context Optional; if present, "AppleServerAuthenticationAllowUATiCloudSetup" with value
1548 Boolean true will allow Test Apple roots and test OIDs on internal releases.
1549 @discussion This policy uses the Basic X.509 policy with validity check
1550 and pinning options:
1551 * The chain is anchored to any of the production Apple Root CAs.
1552 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.12.
1553 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.15.2 or, if
1554 enabled, OID 1.2.840.113635.100.6.27.15.1.
1555 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1556 extension or Common Name.
1557 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1558 * Revocation is checked via any available method.
1559 @result A policy object. The caller is responsible for calling CFRelease
1560 on this when it is no longer needed.
1561 */
1562 __nullable CF_RETURNS_RETAINED
1563 SecPolicyRef SecPolicyCreateAppleiCloudSetupService(CFStringRef hostname, CFDictionaryRef __nullable context)
1564 __OSX_AVAILABLE(10.12.4) __IOS_AVAILABLE(10.3) __TVOS_AVAILABLE(10.2) __WATCHOS_AVAILABLE(3.2);
1565
1566 /*!
1567 @function SecPolicyCreateAppleCompatibilityiCloudSetupService
1568 @abstract Ensure we're appropriately pinned to the iCloud Setup service using compatibility certs
1569 @param hostname Required; hostname to verify the certificate name against.
1570 @discussion This policy uses the Basic X.509 policy with validity check
1571 and pinning options:
1572 * The chain is anchored to the GeoTrust Global CA
1573 * The intermediate has a subject public key info hash matching the public key of
1574 the Apple IST CA G1 intermediate.
1575 * The chain length is 3.
1576 * The leaf has a marker extension with OID 1.2.840.113635.100.6.27.15.2 or
1577 OID 1.2.840.113635.100.6.27.15.1.
1578 * The leaf has the provided hostname in the DNSName of the SubjectAlternativeName
1579 extension or Common Name.
1580 * The leaf is checked against the Black and Gray lists.
1581 * The leaf has ExtendedKeyUsage with the ServerAuth OID.
1582 @result A policy object. The caller is responsible for calling CFRelease
1583 on this when it is no longer needed.
1584 */
1585 __nullable CF_RETURNS_RETAINED
1586 SecPolicyRef SecPolicyCreateAppleCompatibilityiCloudSetupService(CFStringRef hostname)
1587 __OSX_AVAILABLE(10.12.4) __IOS_AVAILABLE(10.3) __TVOS_AVAILABLE(10.2) __WATCHOS_AVAILABLE(3.2);
1588
1589 /*!
1590 @function SecPolicyCreateAppleAppTransportSecurity
1591 @abstract Ensure all certs in the evaluation meet ATS minimums
1592 @discussion This policy is meant to be used alongside an SSL policy in order to enforce App Transport Security certificate rules:
1593 * All certificates use either RSA key sizes of 2048-bits or larger or EC key sizes of 256-bits or larger.
1594 * All certificates use SHA-256 or better for signature hash algorithms.
1595 @result A policy object. The caller is responsible for calling CFRelease
1596 on this when it is no longer needed.
1597 */
1598 __nullable CF_RETURNS_RETAINED
1599 SecPolicyRef SecPolicyCreateAppleAppTransportSecurity(void)
1600 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
1601
1602 /*!
1603 @function SecPolicyCreateMobileSoftwareUpdate
1604 @abstract Returns a policy object for evaluating certificate chains for signing Mobile Software Updates.
1605 @discussion This policy uses the Basic X.509 policy with no validity check
1606 and pinning options:
1607 * The chain is anchored to any of the production Apple Root CAs. Internal releases allow
1608 the chain to be anchored to Test Apple Root CAs if a defaults write for the policy is set.
1609 * There are exactly 3 certs in the chain.
1610 * The intermediate has a marker extension with OID 1.2.840.113635.100.6.2.18.
1611 * The leaf has a marker extension with OID 1.2.840.113635.100.6.57.2, or on internal releases,
1612 1.2.840.113635.100.6.57.1.
1613 * RSA key sizes are 2048-bit or larger. EC key sizes are P-256 or larger.
1614 @result A policy object. The caller is responsible for calling CFRelease
1615 on this when it is no longer needed.
1616 */
1617 __nullable CF_RETURNS_RETAINED
1618 SecPolicyRef SecPolicyCreateMobileSoftwareUpdate(void)
1619 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
1620
1621 /*!
1622 @function SecPolicyCreateAppleBasicAttestationSystem
1623 @abstract Returns a policy object for verifying Basic Attestation Authority SCRT-attested certs
1624 @param testRootHash Optional; The SHA-256 fingerprint of a test root for pinning.
1625 @discussion The resulting policy uses the Basic X.509 policy with validity check and
1626 pinning options:
1627 * The chain is anchored to the Basic Attestation System Root CA.
1628 * There are exactly 3 certs in the chain.
1629 @result A policy object. The caller is responsible for calling CFRelease on this when
1630 it is no longer needed.
1631 */
1632 __nullable CF_RETURNS_RETAINED
1633 SecPolicyRef SecPolicyCreateAppleBasicAttestationSystem(CFDataRef __nullable testRootHash)
1634 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
1635
1636 /*!
1637 @function SecPolicyCreateAppleBasicAttestationUser
1638 @abstract Returns a policy object for verifying Basic Attestation Authority UCRT-attested certs
1639 @param testRootHash Optional; The SHA-256 fingerprint of a test root for pinning.
1640 @discussion The resulting policy uses the Basic X.509 policy with validity check and
1641 pinning options:
1642 * The chain is anchored to the Basic Attestation User Root CA.
1643 * There are exactly 3 certs in the chain.
1644 @result A policy object. The caller is responsible for calling CFRelease on this when
1645 it is no longer needed.
1646 */
1647 __nullable CF_RETURNS_RETAINED
1648 SecPolicyRef SecPolicyCreateAppleBasicAttestationUser(CFDataRef __nullable testRootHash)
1649 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
1650
1651 /*!
1652 @function SecPolicyCreateDemoDigitalCatalog
1653 @abstract Returns a policy object for evaluating certificate chains for signing Digital
1654 Catalog manifests for Demo units.
1655 @discussion This policy uses the Basic X.509 policy with validity check and
1656 pinning options:
1657 * There are exactly 3 certs in the chain.
1658 * The intermediate has common name "DemoUnit CA"
1659 * The leaf has a marker extension with OID 1.2.840.113635.100.6.60
1660 @result A policy object. The caller is responsible for calling CFRelease
1661 on this when it is no longer needed.
1662 */
1663 __nullable CF_RETURNS_RETAINED
1664 SecPolicyRef SecPolicyCreateDemoDigitalCatalogSigning(void)
1665 __OSX_AVAILABLE(10.13.4) __IOS_AVAILABLE(11.3) __TVOS_AVAILABLE(11.3) __WATCHOS_AVAILABLE(4.3);
1666
1667 /*
1668 * Legacy functions (OS X only)
1669 */
1670 #if TARGET_OS_MAC && !TARGET_OS_IPHONE
1671
1672 /*!
1673 @function SecPolicyCopy
1674 @abstract Returns a copy of a policy reference based on certificate type and OID.
1675 @param certificateType A certificate type.
1676 @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.
1677 @param policy The returned policy reference. This is a required parameter.
1678 @result A result code. See "Security Error Codes" (SecBase.h).
1679 @discussion This function is deprecated in Mac OS X 10.7 and later;
1680 to obtain a policy reference, use one of the SecPolicyCreate* functions in SecPolicy.h.
1681 */
1682 OSStatus SecPolicyCopy(CSSM_CERT_TYPE certificateType, const CSSM_OID *policyOID, SecPolicyRef * __nonnull CF_RETURNS_RETAINED policy)
1683 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_3, __MAC_10_7, __IPHONE_NA, __IPHONE_NA);
1684
1685 /*!
1686 @function SecPolicyCopyAll
1687 @abstract Returns an array of all known policies based on certificate type.
1688 @param certificateType A certificate type. This is a optional parameter. Pass CSSM_CERT_UNKNOWN if the certificate type is unknown.
1689 @param policies The returned array of policies. This is a required parameter.
1690 @result A result code. See "Security Error Codes" (SecBase.h).
1691 @discussion This function is deprecated in Mac OS X 10.7 and later;
1692 to obtain a policy reference, use one of the SecPolicyCreate* functions in SecPolicy.h. (Note: there is normally
1693 no reason to iterate over multiple disjointed policies, except to provide a way to edit trust settings for each
1694 policy, as is done in certain certificate UI views. In that specific case, your code should call SecPolicyCreateWithOID
1695 for each desired policy from the list of supported OID constants in SecPolicy.h.)
1696 */
1697 OSStatus SecPolicyCopyAll(CSSM_CERT_TYPE certificateType, CFArrayRef * __nonnull CF_RETURNS_RETAINED policies)
1698 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_3, __MAC_10_7, __IPHONE_NA, __IPHONE_NA);
1699
1700 /* Given a unified SecPolicyRef, return a copy with a legacy
1701 C++ ItemImpl-based Policy instance. Only for internal use;
1702 legacy references cannot be used by SecPolicy API functions. */
1703 __nullable CF_RETURNS_RETAINED
1704 SecPolicyRef SecPolicyCreateItemImplInstance(SecPolicyRef policy);
1705
1706 /* Given a CSSM_OID pointer, return a string which can be passed
1707 to SecPolicyCreateWithProperties. The return value can be NULL
1708 if no supported policy was found for the OID argument. */
1709 __nullable
1710 CFStringRef SecPolicyGetStringForOID(CSSM_OID* oid);
1711
1712 /*!
1713 @function SecPolicyCreateAppleTimeStampingAndRevocationPolicies
1714 @abstract Create timeStamping policy array from a given set of policies by applying identical revocation behavior
1715 @param policyOrArray can be a SecPolicyRef or a CFArray of SecPolicyRef
1716 @discussion This function is deprecated in macOS 10.13 and later. Your code should call SecPolicyCreateAppleTimeStamping
1717 and SecPolicyCreateRevocation instead to obtain these policies, then insert them into an array as needed.
1718 */
1719 __nullable CF_RETURNS_RETAINED
1720 CFArrayRef SecPolicyCreateAppleTimeStampingAndRevocationPolicies(CFTypeRef policyOrArray)
1721 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10, __MAC_10_13, __IPHONE_NA, __IPHONE_NA);
1722
1723 #endif /* TARGET_OS_MAC && !TARGET_OS_IPHONE */
1724
1725 /* MARK: WARNING: The following constants and functions are for project use
1726 * within the Security project and are subject to change without warning */
1727
1728 /*!
1729 @enum Policy Check Keys
1730 @discussion Keys that represent various checks that can be done in a trust
1731 policy. Use outside of the Security project at your own peril.
1732 */
1733 extern const CFStringRef kSecPolicyCheckAnchorApple;
1734 extern const CFStringRef kSecPolicyCheckAnchorSHA1;
1735 extern const CFStringRef kSecPolicyCheckAnchorSHA256;
1736 extern const CFStringRef kSecPolicyCheckAnchorTrusted;
1737 extern const CFStringRef kSecPolicyCheckBasicCertificateProcessing;
1738 extern const CFStringRef kSecPolicyCheckBasicConstraints;
1739 extern const CFStringRef kSecPolicyCheckBasicConstraintsCA;
1740 extern const CFStringRef kSecPolicyCheckBasicConstraintsPathLen;
1741 extern const CFStringRef kSecPolicyCheckBlackListedKey;
1742 extern const CFStringRef kSecPolicyCheckBlackListedLeaf;
1743 extern const CFStringRef kSecPolicyCheckCertificatePolicy;
1744 extern const CFStringRef kSecPolicyCheckChainLength;
1745 extern const CFStringRef kSecPolicyCheckCriticalExtensions;
1746 extern const CFStringRef kSecPolicyCheckEAPTrustedServerNames;
1747 extern const CFStringRef kSecPolicyCheckEmail;
1748 extern const CFStringRef kSecPolicyCheckExtendedKeyUsage;
1749 extern const CFStringRef kSecPolicyCheckExtendedValidation;
1750 extern const CFStringRef kSecPolicyCheckGrayListedKey;
1751 extern const CFStringRef kSecPolicyCheckGrayListedLeaf;
1752 extern const CFStringRef kSecPolicyCheckIdLinkage;
1753 extern const CFStringRef kSecPolicyCheckIntermediateCountry;
1754 extern const CFStringRef kSecPolicyCheckIntermediateEKU;
1755 extern const CFStringRef kSecPolicyCheckIntermediateMarkerOid;
1756 extern const CFStringRef kSecPolicyCheckIntermediateOrganization;
1757 extern const CFStringRef kSecPolicyCheckIntermediateSPKISHA256;
1758 extern const CFStringRef kSecPolicyCheckIssuerCommonName;
1759 extern const CFStringRef kSecPolicyCheckKeySize;
1760 extern const CFStringRef kSecPolicyCheckKeyUsage;
1761 extern const CFStringRef kSecPolicyCheckLeafMarkerOid;
1762 extern const CFStringRef kSecPolicyCheckLeafMarkerOidWithoutValueCheck;
1763 extern const CFStringRef kSecPolicyCheckLeafMarkersProdAndQA;
1764 extern const CFStringRef kSecPolicyCheckMissingIntermediate;
1765 extern const CFStringRef kSecPolicyCheckNameConstraints;
1766 extern const CFStringRef kSecPolicyCheckNoNetworkAccess;
1767 extern const CFStringRef kSecPolicyCheckNonEmptySubject;
1768 extern const CFStringRef kSecPolicyCheckNotValidBefore;
1769 extern const CFStringRef kSecPolicyCheckPinningRequired;
1770 extern const CFStringRef kSecPolicyCheckPolicyConstraints;
1771 extern const CFStringRef kSecPolicyCheckRevocation;
1772 extern const CFStringRef kSecPolicyCheckRevocationIfTrusted;
1773 extern const CFStringRef kSecPolicyCheckRevocationOnline;
1774 extern const CFStringRef kSecPolicyCheckRevocationResponseRequired;
1775 extern const CFStringRef kSecPolicyCheckSSLHostname;
1776 extern const CFStringRef kSecPolicyCheckSignatureHashAlgorithms;
1777 extern const CFStringRef kSecPolicyCheckSubjectCommonName;
1778 extern const CFStringRef kSecPolicyCheckSubjectCommonNamePrefix;
1779 extern const CFStringRef kSecPolicyCheckSubjectCommonNameTEST;
1780 extern const CFStringRef kSecPolicyCheckSubjectOrganization;
1781 extern const CFStringRef kSecPolicyCheckSubjectOrganizationalUnit;
1782 extern const CFStringRef kSecPolicyCheckSystemTrustedWeakHash;
1783 extern const CFStringRef kSecPolicyCheckSystemTrustedWeakKey;
1784 extern const CFStringRef kSecPolicyCheckTemporalValidity;
1785 extern const CFStringRef kSecPolicyCheckUsageConstraints;
1786 extern const CFStringRef kSecPolicyCheckValidRoot;
1787 extern const CFStringRef kSecPolicyCheckWeakKeySize;
1788 extern const CFStringRef kSecPolicyCheckWeakSignature;
1789 extern const CFStringRef kSecPolicyCheckCTRequired;
1790
1791 /* Special option for checking Apple Anchors */
1792 extern const CFStringRef kSecPolicyAppleAnchorIncludeTestRoots;
1793
1794 /* Special option for checking Prod and QA Markers */
1795 extern const CFStringRef kSecPolicyLeafMarkerProd;
1796 extern const CFStringRef kSecPolicyLeafMarkerQA;
1797
1798 /* Special option for checking Revocation */
1799 extern const CFStringRef kSecPolicyCheckRevocationOCSP;
1800 extern const CFStringRef kSecPolicyCheckRevocationCRL;
1801 extern const CFStringRef kSecPolicyCheckRevocationAny;
1802
1803 /* Policy Names */
1804 extern const CFStringRef kSecPolicyNameX509Basic;
1805 extern const CFStringRef kSecPolicyNameSSLServer;
1806 extern const CFStringRef kSecPolicyNameSSLClient;
1807 extern const CFStringRef kSecPolicyNameEAPServer;
1808 extern const CFStringRef kSecPolicyNameEAPClient;
1809 extern const CFStringRef kSecPolicyNameIPSecServer;
1810 extern const CFStringRef kSecPolicyNameIPSecClient;
1811 extern const CFStringRef kSecPolicyNameSMIME;
1812 extern const CFStringRef kSecPolicyNameCodeSigning;
1813 extern const CFStringRef kSecPolicyNameTimeStamping;
1814 extern const CFStringRef kSecPolicyNameOCSPSigner;
1815
1816 /*
1817 * MARK: SecPolicyCheckCert functions
1818 */
1819 bool SecPolicyCheckCertSSLHostname(SecCertificateRef cert, CFTypeRef pvcValue);
1820 bool SecPolicyCheckCertEmail(SecCertificateRef cert, CFTypeRef pvcValue);
1821 bool SecPolicyCheckCertTemporalValidity(SecCertificateRef cert, CFTypeRef pvcValue);
1822 bool SecPolicyCheckCertWeakKeySize(SecCertificateRef cert, CFTypeRef __nullable pvcValue);
1823 bool SecPolicyCheckCertKeyUsage(SecCertificateRef cert, CFTypeRef pvcValue);
1824 bool SecPolicyCheckCertExtendedKeyUsage(SecCertificateRef cert, CFTypeRef pvcValue);
1825 bool SecPolicyCheckCertSubjectCommonName(SecCertificateRef cert, CFTypeRef pvcValue);
1826 bool SecPolicyCheckCertSubjectCommonNamePrefix(SecCertificateRef cert, CFTypeRef pvcValue);
1827 bool SecPolicyCheckCertSubjectCommonNameTEST(SecCertificateRef cert, CFTypeRef pvcValue);
1828 bool SecPolicyCheckCertSubjectOrganization(SecCertificateRef cert, CFTypeRef pvcValue);
1829 bool SecPolicyCheckCertSubjectOrganizationalUnit(SecCertificateRef cert, CFTypeRef pvcValue);
1830 bool SecPolicyCheckCertNotValidBefore(SecCertificateRef cert, CFTypeRef pvcValue);
1831 bool SecPolicyCheckCertEAPTrustedServerNames(SecCertificateRef cert, CFTypeRef pvcValue);
1832 bool SecPolicyCheckCertLeafMarkerOid(SecCertificateRef cert, CFTypeRef pvcValue);
1833 bool SecPolicyCheckCertLeafMarkerOidWithoutValueCheck(SecCertificateRef cert, CFTypeRef pvcValue);
1834 bool SecPolicyCheckCertLeafMarkersProdAndQA(SecCertificateRef cert, CFTypeRef pvcValue);
1835 bool SecPolicyCheckCertNonEmptySubject(SecCertificateRef cert, CFTypeRef __nullable pvcValue);
1836 bool SecPolicyCheckCertKeySize(SecCertificateRef cert, CFTypeRef pvcValue);
1837 bool SecPolicyCheckCertWeakSignature(SecCertificateRef cert, CFTypeRef __nullable pvcValue);
1838 bool SecPolicyCheckCertSignatureHashAlgorithms(SecCertificateRef cert, CFTypeRef pvcValue);
1839 bool SecPolicyCheckCertCertificatePolicy(SecCertificateRef cert, CFTypeRef pvcValue);
1840 bool SecPolicyCheckCertCriticalExtensions(SecCertificateRef cert, CFTypeRef __nullable pvcValue);
1841 bool SecPolicyCheckCertSubjectCountry(SecCertificateRef cert, CFTypeRef pvcValue);
1842
1843 void SecPolicySetName(SecPolicyRef policy, CFStringRef policyName);
1844 __nullable CFArrayRef SecPolicyXPCArrayCopyArray(xpc_object_t xpc_policies, CFErrorRef *error);
1845
1846 void SecPolicySetOptionsValue(SecPolicyRef policy, CFStringRef key, CFTypeRef value);
1847
1848 CF_IMPLICIT_BRIDGING_DISABLED
1849 CF_ASSUME_NONNULL_END
1850
1851 __END_DECLS
1852
1853 #endif /* !_SECURITY_SECPOLICYPRIV_H_ */