Sets the anchor certificates used when evaluating a trust management object.
- iOS 2.0+
- macOS 10.3+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
The trust management object containing the certificate you want to evaluate. A trust management object includes the certificate to be verified plus the policy or policies to be used in evaluating trust. It can optionally also include other certificates to be used in verifying the first certificate. Use the
Secfunction to create a trust management object.
Trust Create With Certificates(_: _: _:)
A reference to an array of
Secobjects representing the set of anchor certificates that are to be considered valid (trusted) anchors by the
Secfunction when verifying a certificate. Pass
Trust Evaluate(_: _:)
NULLto restore the default set of anchor certificates.
A result code. See Security Framework Result Codes.
Sec function looks for an anchor certificate in the array of certificates specified by the
Sec function, or uses a default set provided by the system. In OS X 10.3, for example, the default set of anchors was in the keychain file /System/Library/Keychains/X509Anchors. If you want to create a set of anchor certificates by modifying the default set, call the
Sec function to obtain the current set of anchor certificates, modify that set as you wish, and create a new array of certificates. Then call
Sec with the modified array.
The list of custom anchor certificates is stored in the trust management object and can be retrieved with the
Note that when you call the
Sec function, you are effectively telling the evaluation function to use the anchor certificates in the specified array to evaluate trust regardless of any user-specified trust settings for those certificates. Furthermore, any intermediate certificates based on those anchor certificates are also trusted without consulting user trust settings.
Sec function to set the keychains searched for intermediate certificates in the certificate chain.
It is safe to call this function concurrently on two or more threads as long as it is not used to change the value of a trust management object that is simultaneously being used by another function. For example, you cannot call this function on one thread at the same time as you are calling the evaluation function for the same trust management object on another thread, but you can call this function and simultaneously evaluate a different trust management object on another thread. Similarly, calls to functions that return information about a trust management object (such as the
Sec function) may fail or return an unexpected result if this function is simultaneously changing the same trust management object on another thread.