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