Function

SecTrustCopyCustomAnchorCertificates

Retrieves the custom anchor certificates, if any, used by a given trust.

Declaration

OSStatus SecTrustCopyCustomAnchorCertificates(SecTrustRef trust, CFArrayRef  _Nullable *anchors);

Parameters

trust

The trust management object from which you wish to retrieve the custom anchor certificates.

anchors

On return, a reference to an array of SecCertificateRef objects representing the set of anchor certificates that are considered valid (trusted) anchors by the SecTrustEvaluateWithError function when verifying a certificate using the trust management object in the trust parameter. Returns NULL if no custom anchors have been specified. Call the CFRelease function to release this object when you are finished with it.

Return Value

Discussion

You can use the SecTrustSetAnchorCertificates function to set custom anchor certificates.

It is safe to call this function concurrently on two or more threads as long as it is not used to get values from a trust management object that is simultaneously being changed by another function. For example, you can call this function on two threads at the same time, but not if you are simultaneously calling the SecTrustSetAnchorCertificates function for the same trust management object on another thread.

See Also

Trust Components

SecTrustCopyPublicKey

Returns the public key for a leaf certificate after it has been evaluated.

SecTrustGetCertificateCount

Returns the number of certificates in an evaluated certificate chain.

SecTrustGetCertificateAtIndex

Returns a specific certificate from the certificate chain used to evaluate trust.

SecTrustGetVerifyTime

Gets the absolute time against which the certificates in a trust management object are verified.

SecTrustCopyAnchorCertificates

Retrieves the anchor (root) certificates stored by macOS.

SecTrustCopyExceptions

Returns an opaque cookie containing exceptions to trust policies that will allow future evaluations of the current certificate to succeed.

SecTrustCopyPolicies

Retrieves the policies used by a given trust management object.

SecTrustCopyProperties

Returns an array containing the properties of a trust object.