2 * Copyright (c) 2003-2018 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
26 The functions and data types in SecTrustPriv implement trust computation
27 and allow the user to apply trust decisions to the trust configuration.
30 #ifndef _SECURITY_SECTRUSTPRIV_H_
31 #define _SECURITY_SECTRUSTPRIV_H_
33 #include <Security/SecTrust.h>
34 #include <CoreFoundation/CFString.h>
35 #include <CoreFoundation/CFData.h>
36 #include <CoreFoundation/CFDictionary.h>
41 CF_ASSUME_NONNULL_BEGIN
42 CF_IMPLICIT_BRIDGING_ENABLED
44 /* Constants used as keys in property lists. See
45 SecTrustCopySummaryPropertiesAtIndex for more information. */
46 extern const CFStringRef kSecPropertyKeyType
;
47 extern const CFStringRef kSecPropertyKeyLabel
;
48 extern const CFStringRef kSecPropertyKeyLocalizedLabel
;
49 extern const CFStringRef kSecPropertyKeyValue
;
51 extern const CFStringRef kSecPropertyTypeWarning
;
52 extern const CFStringRef kSecPropertyTypeSuccess
;
53 extern const CFStringRef kSecPropertyTypeSection
;
54 extern const CFStringRef kSecPropertyTypeData
;
55 extern const CFStringRef kSecPropertyTypeString
;
56 extern const CFStringRef kSecPropertyTypeURL
;
57 extern const CFStringRef kSecPropertyTypeDate
;
59 /* Constants used as keys in the dictionary returned by SecTrustCopyInfo. */
60 extern const CFStringRef kSecTrustInfoExtendedValidationKey
;
61 extern const CFStringRef kSecTrustInfoCompanyNameKey
;
62 extern const CFStringRef kSecTrustInfoRevocationKey
;
63 extern const CFStringRef kSecTrustInfoRevocationValidUntilKey
;
64 extern const CFStringRef kSecTrustInfoCertificateTransparencyKey
;
66 /* Constants used as keys in the certificate details dictionary.
67 An array of per-certificate details is returned by SecTrustCopyResult
68 as the value of the kSecTrustResultDetails key.
70 extern const CFStringRef kSecCertificateDetailStatusCodes
;
71 /*__OSX_AVAILABLE_STARTING(__MAC_10_13, __IPHONE_11_0);*/
74 @enum Trust Result Constants
75 @discussion Predefined key constants used to obtain values in a
76 dictionary of trust evaluation results for a certificate chain,
77 as retrieved from a call to SecTrustCopyResult.
79 @constant kSecTrustResultDetails
80 This key will be present if a trust evaluation has been performed.
81 Its value is a CFArrayRef of CFDictionaryRef representing detailed
82 status info for each certificate in the completed chain.
83 @constant kSecTrustRevocationReason
84 This key will be present iff this chain had its revocation checked,
85 and a "revoked" response was received. The value of this key will
86 be a CFNumberRef indicating the reason for revocation. The possible
87 reason code values are described in RFC 5280, section 5.3.1.
89 extern const CFStringRef kSecTrustResultDetails
;
90 /*__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_9_0);*/
91 extern const CFStringRef kSecTrustRevocationReason
;
92 /*__OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);*/
95 @function SecTrustCopySummaryPropertiesAtIndex
96 @abstract Return a property array for the certificate.
97 @param trust A reference to the trust object to evaluate.
98 @param ix The index of the requested certificate. Indices run from 0
99 (leaf) to the anchor (or last certificate found if no anchor was found).
100 @result A property array. It is the caller's responsibility to CFRelease
101 the returned array when it is no longer needed. This function returns a
102 short summary description of the certificate in question. The property
103 at index 0 of the array might also include general information about the
104 entire chain's validity in the context of this trust evaluation.
106 @discussion Returns a property array for this trust certificate. A property
107 array is an array of CFDictionaryRefs. Each dictionary (we call it a
108 property for short) has the following keys:
110 kSecPropertyKeyType This key's value determines how this property
111 should be displayed. Its associated value is one of the
113 kSecPropertyTypeWarning
114 The kSecPropertyKeyLocalizedLabel and kSecPropertyKeyLabel keys are not
115 set. The kSecPropertyKeyValue is a CFStringRef which should
116 be displayed in yellow with a warning triangle.
117 kSecPropertyTypeError
118 The kSecPropertyKeyLocalizedLabel and kSecPropertyKeyLabel keys are not
119 set. The kSecPropertyKeyValue is a CFStringRef which should
120 be displayed in red with an error X.
121 kSecPropertyTypeSuccess
122 The kSecPropertyKeyLocalizedLabel and kSecPropertyKeyLabel keys are not
123 set. The kSecPropertyKeyValue is a CFStringRef which should
124 be displayed in green with a checkmark in front of it.
125 kSecPropertyTypeTitle
126 The kSecPropertyKeyLocalizedLabel and kSecPropertyKeyLabel keys are not
127 set. The kSecPropertyKeyValue is a CFStringRef which should
128 be displayed in a larger bold font.
129 kSecPropertyTypeSection
130 The optional kSecPropertyKeyLocalizedLabel is a CFStringRef with the name
131 of the next section to display. The value of the
132 kSecPropertyKeyValue key is a CFArrayRef which is a property
133 array as defined here.
135 The optional kSecPropertyKeyLocalizedLabel is a CFStringRef containing
136 the localized label for the value for the kSecPropertyKeyValue.
137 The type of this value is a CFDataRef. Its contents should be
138 displayed as: "bytes length_of_data : hexdump_of_data". Ideally
139 the UI will only show one line of hex dump data and have a
140 disclosure arrow to see the remainder.
141 kSecPropertyTypeString
142 The optional kSecPropertyKeyLocalizedLabel is a CFStringRef containing
143 the localized label for the value for the kSecPropertyKeyValue.
144 The type of this value is a CFStringRef. It's contents should be
145 displayed in the normal font.
147 The optional kSecPropertyKeyLocalizedLabel is a CFStringRef containing
148 the localized label for the value for the kSecPropertyKeyValue.
149 The type of this value is a CFURLRef. It's contents should be
150 displayed as a hyperlink.
152 The optional kSecPropertyKeyLocalizedLabel is a CFStringRef containing
153 the localized label for the value for the kSecPropertyKeyValue.
154 The type of this value is a CFDateRef. It's contents should be
155 displayed in human readable form (probably in the current
157 kSecPropertyKeyLocalizedLabel
158 Human readable localized label for a given property.
160 See description of kSecPropertyKeyType to determine what the value
163 Non localized key (label) for this value. This is only
164 present for properties with fixed label names.
165 @result A property array. It is the caller's responsability to CFRelease
166 the returned array when it is no longer needed.
168 __nullable CF_RETURNS_RETAINED
169 CFArrayRef
SecTrustCopySummaryPropertiesAtIndex(SecTrustRef trust
, CFIndex ix
);
172 @function SecTrustCopyDetailedPropertiesAtIndex
173 @abstract Return a property array for the certificate.
174 @param trust A reference to the trust object to evaluate.
175 @param ix The index of the requested certificate. Indices run from 0
176 (leaf) to the anchor (or last certificate found if no anchor was found).
177 @result A property array. It is the caller's responsibility to CFRelease
178 the returned array when it is no longer needed.
179 See SecTrustCopySummaryPropertiesAtIndex on how to intepret this array.
180 Unlike that function call this function returns a detailed description
181 of the certificate in question.
183 __nullable CF_RETURNS_RETAINED
184 CFArrayRef
SecTrustCopyDetailedPropertiesAtIndex(SecTrustRef trust
, CFIndex ix
);
187 @function SecTrustCopyInfo
188 @abstract Return a dictionary with additional information about the
189 evaluated certificate chain for use by clients.
190 @param trust A reference to an evaluated trust object.
191 @discussion Returns a dictionary for this trust evaluation. This
192 dictionary may have the following keys:
194 kSecTrustInfoExtendedValidationKey this key will be present and have
195 a value of kCFBooleanTrue if this chain was validated for EV.
196 kSecTrustInfoCompanyNameKey Company name field of subject of leaf
197 certificate, this field is meant to be displayed to the user
198 if the kSecTrustInfoExtendedValidationKey is present.
199 kSecTrustInfoRevocationKey this key will be present iff this chain
200 had its revocation checked. The value will be a kCFBooleanTrue
201 if revocation checking was successful and none of the
202 certificates in the chain were revoked.
203 The value will be kCFBooleanFalse if no current revocation status
204 could be obtained for one or more certificates in the chain due
205 to connection problems or timeouts etc. This is a hint to a
206 client to retry revocation checking at a later time.
207 kSecTrustInfoRevocationValidUntilKey this key will be present iff
208 kSecTrustInfoRevocationKey has a value of kCFBooleanTrue.
209 The value will be a CFDateRef representing the earliest date at
210 which the revocation info for one of the certificates in this chain
213 @result A dictionary with various fields that can be displayed to the user,
214 or NULL if no additional info is available or the trust has not yet been
215 validated. The caller is responsible for calling CFRelease on the value
216 returned when it is no longer needed.
218 __nullable CF_RETURNS_RETAINED
219 CFDictionaryRef
SecTrustCopyInfo(SecTrustRef trust
);
221 /* For debugging purposes. */
223 CFArrayRef
SecTrustGetDetails(SecTrustRef trust
);
225 __nullable CF_RETURNS_RETAINED
226 CFArrayRef
SecTrustCopyFilteredDetails(SecTrustRef trust
);
229 @function SecTrustIsExpiredOnly
230 @abstract Determine whether expiration is the only problem with a certificate chain.
231 @param trust A reference to a trust object.
232 @result A boolean value indicating whether expiration is the only problem found
233 with the certificate chain in the given trust reference.
234 @discussion Returns true if one or more certificates in the chain have expired,
235 expiration is an error (i.e. it is not being ignored by existing trust settings),
236 and it is the only error encountered. Returns false if the certificate(s) have not
237 expired, or are expired but have trust settings to override their expiration,
238 or if the trust chain has other errors beside expiration. Your code should call
239 this function after SecTrustEvaluate has returned a recoverable trust failure,
240 so you can distinguish this case from other possible errors.
242 Boolean
SecTrustIsExpiredOnly(SecTrustRef trust
)
243 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
245 /* For debugging purposes. */
246 __nullable CF_RETURNS_RETAINED
247 CFStringRef
SecTrustCopyFailureDescription(SecTrustRef trust
);
250 @function SecTrustGetTrustStoreVersionNumber
251 @abstract Ask trustd what trust store version it is using.
252 @param error A returned error if trustd failed to answer.
253 @result The current version of the trust store. 0 upon failure.
255 uint64_t SecTrustGetTrustStoreVersionNumber(CFErrorRef _Nullable
* _Nullable CF_RETURNS_RETAINED error
);
258 @function SecTrustOTAPKIGetUpdatedAsset
259 @abstract Trigger trustd to fetch a new trust supplementals asset right now.
260 @param error A returned error if trustd failed to update the asset.
261 @result The current version of the update, regardless of the success of the update.
262 @discussion This function blocks up to 1 minute until trustd has finished with the
263 asset download and update. You should use the error parameter to determine whether
264 the update was was successful. The current asset version is always returned.
266 uint64_t SecTrustOTAPKIGetUpdatedAsset(CFErrorRef _Nullable
* _Nullable CF_RETURNS_RETAINED error
);
269 @function SecTrustFlushResponseCache
270 @abstract Removes all OCSP responses from the per-user response cache.
271 @param error An optional pointer to an error object
272 @result A boolean value indicating whether the operation was successful.
273 @discussion If the error parameter is supplied, and the function returns false,
274 the caller is subsequently responsible for releasing the returned CFErrorRef.
276 Boolean
SecTrustFlushResponseCache(CFErrorRef _Nullable
* _Nullable CF_RETURNS_RETAINED error
)
277 __OSX_AVAILABLE(10.13.4) __IOS_AVAILABLE(11.3) __TVOS_AVAILABLE(11.3) __WATCHOS_AVAILABLE(4.3);
280 @function SecTrustSignedCertificateTimestampList
281 @abstract Attach SignedCertificateTimestampList data to a trust object.
282 @param trust A reference to a trust object.
283 @param sctArray is a CFArray of CFData objects each containing a SCT (per RFC 6962).
284 @result A result code. See "Security Error Codes" (SecBase.h).
285 @discussion Allows the caller to provide SCT data (which may be
286 obtained during a TLS/SSL handshake, per RFC 6962) as input to a trust
289 OSStatus
SecTrustSetSignedCertificateTimestamps(SecTrustRef trust
, CFArrayRef sctArray
);
292 @function SecTrustSetTrustedLogs
293 @abstract Sets the trusted CT logs for a given trust.
294 @param trust A reference to a trust object.
295 @param trustedLogs An array of trusted logs.
296 @result A result code. See "Security Error Codes" (SecBase.h).
297 @discussion trustedLog is a CFArray of CFData containing the DER-encode SubjectPublicKeyInfo
298 of the trusted CT logs.
300 OSStatus
SecTrustSetTrustedLogs(SecTrustRef trust
, CFArrayRef trustedLogs
);
302 /* Keychain searches are allowed by default. Use this to turn off seaching of
303 -keychain search list (i.e. login.keychain, system.keychain)
304 -Local Items/iCloud Keychain
305 -user- and admin-trusted roots
306 -network-fetched issuers
307 User must provide all necessary certificates in the input certificates and/or anchors. */
308 OSStatus
SecTrustSetKeychainsAllowed(SecTrustRef trust
, Boolean allowed
)
309 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
311 /* Get the keychain search policy for the trust object. */
312 OSStatus
SecTrustGetKeychainsAllowed(SecTrustRef trust
, Boolean
* __nonnull allowed
)
313 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
316 @function SecTrustEvaluateLeafOnly
317 @abstract Evaluates the leaf of the trust reference synchronously.
318 @param trust A reference to the trust object to evaluate.
319 @param result A pointer to a result type.
320 @result A result code. See "Security Error Codes" (SecBase.h).
321 @discussion This function will only evaluate the trust of the leaf certificate.
322 No chain will be built and only those aspects of the SecPolicyRef that address
323 the expected contents of the leaf will be checked. This function does not honor
324 any set exceptions or usage constraints.
326 OSStatus
SecTrustEvaluateLeafOnly(SecTrustRef trust
, SecTrustResultType
* __nonnull result
)
327 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
330 @function SecTrustSerialize
331 @abstract Creates a serialized version of the trust object
332 @param trust A reference to the trust object to serialize.
333 @param error A pointer to an error.
334 @result The serialized trust object.
335 @discussion This function is intended to be used to share SecTrustRefs between
336 processes. Saving the results to disk or sending them over network channels
337 may cause unexpected behavior.
339 __nullable CF_RETURNS_RETAINED
340 CFDataRef
SecTrustSerialize(SecTrustRef trust
, CFErrorRef
*error
)
341 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
344 @function SecTrustDeserialize
345 @abstract Creates a trust object from the serialized data
346 @param serializedTrust A reference to the serialized trust object
347 @param error A pointer to an error.
348 @result A trust object
349 @discussion This function is intended to be used to share SecTrustRefs between
350 processes. Saving the results to disk or sending them over network channels
351 may cause unexpected behavior.
353 __nullable CF_RETURNS_RETAINED
354 SecTrustRef
SecTrustDeserialize(CFDataRef serializedTrust
, CFErrorRef
*error
)
355 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
358 @function SecTrustGetTrustExceptionsArray
359 @abstract Return the exceptions array currently set in the trust object
360 @param trust A reference to the trust object
361 @result The array of exceptions.
362 @discussion This function returns an array of exceptions that was previously set
363 using SecTrustSetExceptions, unlike SecTrustCopyExceptions which returns the
364 exceptions which could be set using SecTrustSetExceptions.
366 __nullable CFArrayRef
SecTrustGetTrustExceptionsArray(SecTrustRef trust
)
367 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
370 @function SecTrustCopyInputCertificates
371 @abstract Return the array of certificates currently set in the trust object
372 @param trust A reference to the trust object
373 @param certificates On return, an array of the certificates used by this trust.
374 Call the CFRelease function to release this reference.
375 @result A result code. See "Security Error Codes" (SecBase.h)
377 OSStatus
SecTrustCopyInputCertificates(SecTrustRef trust
, CFArrayRef
* _Nonnull CF_RETURNS_RETAINED certificates
)
378 __OSX_AVAILABLE(10.12.4) __IOS_AVAILABLE(10.3) __TVOS_AVAILABLE(10.2) __WATCHOS_AVAILABLE(3.2);
381 @function SecTrustAddToInputCertificates
382 @abstract Add certificate(s) to the currently set certificates in the trust object
383 @param trust A reference to the trust object
384 @param certificates The group of certificates to add. This can either be a CFArrayRef
385 of SecCertificateRef objects or a single SecCertificateRef.
386 @result A result code. See "Security Error Codes" (SecBase.h)
388 OSStatus
SecTrustAddToInputCertificates(SecTrustRef trust
, CFTypeRef _Nonnull certificates
)
389 __OSX_AVAILABLE(10.12.4) __IOS_AVAILABLE(10.3) __TVOS_AVAILABLE(10.2) __WATCHOS_AVAILABLE(3.2);
392 @function SecTrustSetPinningPolicyName
393 @abstract Set the policy name to be used during the trust evaluation.
394 @param trust A reference to the trust object
395 @param policyName A string representing the name of the pinning policy to be used.
396 @result A result code. See "Security Error Codes" (SecBase.h)
397 @discussion This function permits the caller to enable the dynamic lookup of the
398 pinning policy using a built-in database as an alternative to using a SecPolicyCreate function
399 with the pinning rules and calling SecTrustCreateWithCertificates or SecTrustSetPolicies.
401 OSStatus
SecTrustSetPinningPolicyName(SecTrustRef trust
, CFStringRef policyName
)
402 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
405 @function SecTrustSetPinningException
406 @abstract Remove pinning requirement from this trust evaluation
407 @param trust A reference to the trust object
408 @result A result code. See "Security Error Codes" (SecBase.h)
409 @discussion This function provides an exception for this particular trust for a bundle that
410 otherwise requires pinning for all connections. Bundles use the SecTrustPinningRequired key
411 with boolean value of true in their info plist to indicate that all SSL connections from the
412 bundle must be pinned.
414 OSStatus
SecTrustSetPinningException(SecTrustRef trust
)
415 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
419 @function SecTrustEvaluateFastAsync
420 @abstract Evaluates a trust reference asynchronously.
421 @param trust A reference to the trust object to evaluate.
422 @param queue A dispatch queue on which the result callback will be
423 executed. Note that this function MUST be called from that queue.
424 @param result A SecTrustCallback block which will be executed when the
425 trust evaluation is complete. The block is guaranteed to be called exactly once
426 when the result code is errSecSuccess, and not called otherwise. Note that this
427 block may be called synchronously inline if no asynchronous operations are required.
428 @result A result code. See "Security Error Codes" (SecBase.h).
430 OSStatus
SecTrustEvaluateFastAsync(SecTrustRef trust
, dispatch_queue_t queue
, SecTrustCallback result
)
431 __API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0));
435 @function SecTrustReportTLSAnalytics
436 @discussion This function MUST NOT be called outside of the TLS stack.
438 bool SecTrustReportTLSAnalytics(CFStringRef eventName
, xpc_object_t eventAttributes
, CFErrorRef _Nullable
* _Nullable CF_RETURNS_RETAINED error
)
439 __API_AVAILABLE(macos(10.13.4), ios(11.3), tvos(11.3), watchos(4.3));
441 CF_IMPLICIT_BRIDGING_DISABLED
442 CF_ASSUME_NONNULL_END
445 * Legacy functions (OS X only)
447 #if TARGET_OS_MAC && !TARGET_OS_IPHONE
449 CF_ASSUME_NONNULL_BEGIN
450 CF_IMPLICIT_BRIDGING_ENABLED
453 #pragma clang diagnostic push
454 #pragma clang diagnostic ignored "-Wfour-char-constants"
455 #endif /* SEC_OS_IPHONE */
457 unique keychain item attributes for user trust records.
460 kSecTrustCertAttr
= 'tcrt',
461 kSecTrustPolicyAttr
= 'tpol',
462 /* Leopard and later */
463 kSecTrustPubKeyAttr
= 'tpbk',
464 kSecTrustSignatureAttr
= 'tsig'
468 #pragma clang diagnostic pop
469 #endif /* SEC_OS_IPHONE */
472 @function SecTrustGetUserTrust
473 @abstract Gets the user-specified trust settings of a certificate and policy.
474 @param certificate A reference to a certificate.
475 @param policy A reference to a policy.
476 @param trustSetting On return, a pointer to the user specified trust settings.
477 @result A result code. See "Security Error Codes" (SecBase.h).
478 @availability Mac OS X version 10.4. Deprecated in Mac OS X version 10.5.
480 OSStatus
SecTrustGetUserTrust(SecCertificateRef __nullable certificate
, SecPolicyRef __nullable policy
, SecTrustUserSetting
* __nullable trustSetting
)
481 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4
, __MAC_10_5
, __IPHONE_NA
, __IPHONE_NA
);
484 @function SecTrustSetUserTrust
485 @abstract Sets the user-specified trust settings of a certificate and policy.
486 @param certificate A reference to a certificate.
487 @param policy A reference to a policy.
488 @param trustSetting The user-specified trust settings.
489 @result A result code. See "Security Error Codes" (SecBase.h).
490 @availability Mac OS X version 10.4. Deprecated in Mac OS X version 10.5.
491 @discussion as of Mac OS version 10.5, this will result in a call to
492 SecTrustSettingsSetTrustSettings().
494 OSStatus
SecTrustSetUserTrust(SecCertificateRef __nullable certificate
, SecPolicyRef __nullable policy
, SecTrustUserSetting trustSetting
)
495 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4
, __MAC_10_5
, __IPHONE_NA
, __IPHONE_NA
);
498 @function SecTrustSetUserTrustLegacy
499 @abstract Sets the user-specified trust settings of a certificate and policy.
500 @param certificate A reference to a certificate.
501 @param policy A reference to a policy.
502 @param trustSetting The user-specified trust settings.
503 @result A result code. See "Security Error Codes" (SecBase.h).
505 @This is the private version of what used to be SecTrustSetUserTrust(); it operates
506 on UserTrust entries as that function used to. The current SecTrustSetUserTrust()
507 function operated on Trust Settings.
509 OSStatus
SecTrustSetUserTrustLegacy(SecCertificateRef __nullable certificate
, SecPolicyRef __nullable policy
, SecTrustUserSetting trustSetting
)
510 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5
, __MAC_10_12
, __IPHONE_NA
, __IPHONE_NA
);
513 @function SecTrustGetCSSMAnchorCertificates
514 @abstract Retrieves the CSSM anchor certificates.
515 @param cssmAnchors A pointer to an array of anchor certificates.
516 @param cssmAnchorCount A pointer to the number of certificates in anchors.
517 @result A result code. See "Security Error Codes" (SecBase.h).
518 @availability Mac OS X version 10.4. Deprecated in Mac OS X version 10.5.
520 OSStatus
SecTrustGetCSSMAnchorCertificates(const CSSM_DATA
* __nullable
* __nullable cssmAnchors
, uint32
*cssmAnchorCount
)
521 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4
, __MAC_10_5
, __IPHONE_NA
, __IPHONE_NA
);
524 @function SecTrustCopyExtendedResult
525 @abstract Gets the extended trust result after an evaluation has been performed.
526 @param trust A trust reference.
527 @param result On return, result points to a CFDictionaryRef containing extended trust results (if no error occurred).
528 The caller is responsible for releasing this dictionary with CFRelease when finished with it.
529 @result A result code. See "Security Error Codes" (SecBase.h).
530 @discussion This function may only be used after SecTrustEvaluate has been called for the trust reference, otherwise
531 errSecTrustNotAvailable is returned. If the certificate is not an extended validation certificate, there is
532 no extended result data and errSecDataNotAvailable is returned. Currently, only one dictionary key is defined
533 (kSecEVOrganizationName).
535 Note: this function will be deprecated in a future release of OS X. Your
536 code should use SecTrustCopyResult to obtain the trust results dictionary.
538 OSStatus
SecTrustCopyExtendedResult(SecTrustRef trust
, CFDictionaryRef
* __nonnull CF_RETURNS_RETAINED result
)
539 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5
, __MAC_10_12
, __IPHONE_NA
, __IPHONE_NA
);
542 * Preference-related strings for Revocation policies.
546 * Preference domain, i.e., the name of a plist in ~/Library/Preferences or in
547 * /Library/Preferences
549 #define kSecRevocationDomain "com.apple.security.revocation"
551 /* OCSP and CRL style keys, followed by values used for both of them */
552 #define kSecRevocationOcspStyle CFSTR("OCSPStyle")
553 #define kSecRevocationCrlStyle CFSTR("CRLStyle")
554 #define kSecRevocationOff CFSTR("None")
555 #define kSecRevocationBestAttempt CFSTR("BestAttempt")
556 #define kSecRevocationRequireIfPresent CFSTR("RequireIfPresent")
557 #define kSecRevocationRequireForAll CFSTR("RequireForAll")
559 /* Which first if both enabled? */
560 #define kSecRevocationWhichFirst CFSTR("RevocationFirst")
561 #define kSecRevocationOcspFirst CFSTR("OCSP")
562 #define kSecRevocationCrlFirst CFSTR("CRL")
564 /* boolean: A "this policy is sufficient per cert" for each */
565 #define kSecRevocationOCSPSufficientPerCert CFSTR("OCSPSufficientPerCert")
566 #define kSecRevocationCRLSufficientPerCert CFSTR("CRLSufficientPerCert")
568 /* local OCSP responder URI, value arbitrary string value */
569 #define kSecOCSPLocalResponder CFSTR("OCSPLocalResponder")
571 /* Extended trust result keys (now in public API) */
572 #define kSecEVOrganizationName kSecTrustOrganizationName
573 #define kSecTrustExpirationDate kSecTrustRevocationValidUntilDate
575 CF_IMPLICIT_BRIDGING_DISABLED
576 CF_ASSUME_NONNULL_END
578 #endif /* TARGET_OS_MAC && !TARGET_OS_IPHONE */
582 #endif /* !_SECURITY_SECTRUSTPRIV_H_ */