<!--
{
  "documentType" : "article",
  "framework" : "Security",
  "identifier" : "/documentation/Security/trust",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Trust"
}
-->

# Trust

Evaluate trust based on a given policy.

## Discussion

Before using a certificate, you evaluate its trustworthiness for a particular purpose.

If you know that a certificate comes unaltered from its sender, you can be confident that its embedded public key does as well. You can also take at face value claims made by the certificate about when and for what purpose the public key may be used. You can securely engage in the operations described in [Using Keys for Encryption](/documentation/Security/using-keys-for-encryption) and [Signing and Verifying](/documentation/Security/signing-and-verifying) without prior arrangement between sender and receiver.

## Topics

### Essentials

[Creating a Trust Object](/documentation/Security/creating-a-trust-object)

Construct a trust object from a certificate and a policy.

[`SecTrustCreateWithCertificates(_:_:_:)`](/documentation/Security/SecTrustCreateWithCertificates(_:_:_:))

Creates a trust management object based on certificates and policies.

[`SecTrust`](/documentation/Security/SecTrust)

An object used to evaluate trust.

[`SecTrustGetTypeID()`](/documentation/Security/SecTrustGetTypeID())

Returns the unique identifier of the opaque type to which a trust object belongs.

### Trust Evaluation

[Evaluating a Trust and Parsing the Result](/documentation/Security/evaluating-a-trust-and-parsing-the-result)

Learn what to expect when evaluating a trust object.

[`SecTrustEvaluateWithError(_:_:)`](/documentation/Security/SecTrustEvaluateWithError(_:_:))

Evaluates trust for the specified certificate and policies.

[`SecTrustEvaluateAsyncWithError(_:_:_:)`](/documentation/Security/SecTrustEvaluateAsyncWithError(_:_:_:))

Evaluates a trust object asynchronously on the specified dispatch queue.

[`SecTrustWithErrorCallback`](/documentation/Security/SecTrustWithErrorCallback)

A block called with the results of an asynchronous trust evaluation.

### Trust Evaluation Result

[Discovering Why a Trust Evaluation Failed](/documentation/Security/discovering-why-a-trust-evaluation-failed)

Determine whether you can recover from a failed trust evaluation.

[`SecTrustGetTrustResult(_:_:)`](/documentation/Security/SecTrustGetTrustResult(_:_:))

Returns the result code from the most recent trust evaluation.

[`SecTrustResultType`](/documentation/Security/SecTrustResultType)

Trust evaluation result codes.

[`SecTrustCopyResult(_:)`](/documentation/Security/SecTrustCopyResult(_:))

Returns a dictionary containing information about an evaluated trust.

[Trust Result Dictionary Keys](/documentation/Security/trust-result-dictionary-keys)

Recognize the keys that appear in a dictionary containing information about an evaluated certification chain.

### Trust Components

[`SecTrustCopyPublicKey(_:)`](/documentation/Security/SecTrustCopyPublicKey(_:))

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

[`SecTrustGetCertificateCount(_:)`](/documentation/Security/SecTrustGetCertificateCount(_:))

Returns the number of certificates in an evaluated certificate chain.

[`SecTrustGetCertificateAtIndex(_:_:)`](/documentation/Security/SecTrustGetCertificateAtIndex(_:_:))

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

[`SecTrustGetVerifyTime(_:)`](/documentation/Security/SecTrustGetVerifyTime(_:))

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

[`SecTrustCopyAnchorCertificates(_:)`](/documentation/Security/SecTrustCopyAnchorCertificates(_:))

Retrieves the anchor (root) certificates stored by macOS.

[`SecTrustCopyCustomAnchorCertificates(_:_:)`](/documentation/Security/SecTrustCopyCustomAnchorCertificates(_:_:))

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

[`SecTrustCopyExceptions(_:)`](/documentation/Security/SecTrustCopyExceptions(_:))

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

[`SecTrustCopyPolicies(_:_:)`](/documentation/Security/SecTrustCopyPolicies(_:_:))

Retrieves the policies used by a given trust management object.

[`SecTrustCopyProperties(_:)`](/documentation/Security/SecTrustCopyProperties(_:))

Returns an array containing the properties of a trust object.

### Advanced Trust Configuation

[Configuring a Trust](/documentation/Security/configuring-a-trust)

Work around a recoverable trust failure.

[`SecTrustSetVerifyDate(_:_:)`](/documentation/Security/SecTrustSetVerifyDate(_:_:))

Sets the date and time against which the certificates in a trust management object are verified.

[`SecTrustSetAnchorCertificates(_:_:)`](/documentation/Security/SecTrustSetAnchorCertificates(_:_:))

Sets the anchor certificates used when evaluating a trust management object.

[`SecTrustSetAnchorCertificatesOnly(_:_:)`](/documentation/Security/SecTrustSetAnchorCertificatesOnly(_:_:))

Reenables trusting built-in anchor certificates.

[`SecTrustSetExceptions(_:_:)`](/documentation/Security/SecTrustSetExceptions(_:_:))

Sets a list of exceptions that should be ignored when the certificate is evaluated.

[`SecTrustSetPolicies(_:_:)`](/documentation/Security/SecTrustSetPolicies(_:_:))

Sets the policies to use in an evaluation.

[`SecTrustSetOptions(_:_:)`](/documentation/Security/SecTrustSetOptions(_:_:))

Sets option flags for customizing evaluation of a trust object.

[`SecTrustOptionFlags`](/documentation/Security/SecTrustOptionFlags)

The option flags used to condition a trust evaluation.

[`SecTrustGetNetworkFetchAllowed(_:_:)`](/documentation/Security/SecTrustGetNetworkFetchAllowed(_:_:))

Indicates whether a trust evaluation is permitted to fetch missing intermediate certificates from the network.

[`SecTrustSetNetworkFetchAllowed(_:_:)`](/documentation/Security/SecTrustSetNetworkFetchAllowed(_:_:))

Specifies whether a trust evaluation is permitted to fetch missing intermediate certificates from the network.

[`SecTrustSetOCSPResponse(_:_:)`](/documentation/Security/SecTrustSetOCSPResponse(_:_:))

Attaches Online Certificate Status Protocol (OSCP) response data to a trust object.

[`SecTrustSetSignedCertificateTimestamps(_:_:)`](/documentation/Security/SecTrustSetSignedCertificateTimestamps(_:_:))

Attaches signed certificate timestamp data to a trust object.

### Trust Settings

[`SecTrustSettingsCopyCertificates(_:_:)`](/documentation/Security/SecTrustSettingsCopyCertificates(_:_:))

Obtains an array of all certificates that have trust settings in a specific trust settings domain.

[`SecTrustSettingsCopyModificationDate(_:_:_:)`](/documentation/Security/SecTrustSettingsCopyModificationDate(_:_:_:))

Obtains the date and time at which a certificate’s trust settings were last modified.

[Usage Constraints Dictionary Keys](/documentation/Security/usage-constraints-dictionary-keys)

Use these trust settings keys in a usage constraints dictionary.

[`SecTrustSettingsCopyTrustSettings(_:_:_:)`](/documentation/Security/SecTrustSettingsCopyTrustSettings(_:_:_:))

Obtains the trust settings for a certificate.

[`SecTrustSettingsCreateExternalRepresentation(_:_:)`](/documentation/Security/SecTrustSettingsCreateExternalRepresentation(_:_:))

Obtains an external, portable representation of the specified domain’s trust settings.

[`SecTrustSettingsImportExternalRepresentation(_:_:)`](/documentation/Security/SecTrustSettingsImportExternalRepresentation(_:_:))

Imports trust settings into a trust domain.

[`SecTrustSettingsRemoveTrustSettings(_:_:)`](/documentation/Security/SecTrustSettingsRemoveTrustSettings(_:_:))

Deletes the trust settings for a certificate.

[`SecTrustSettingsSetTrustSettings(_:_:_:)`](/documentation/Security/SecTrustSettingsSetTrustSettings(_:_:_:))

Specifies trust settings for a certificate.

[`kSecTrustSettingsDefaultRootCertSetting`](/documentation/Security/kSecTrustSettingsDefaultRootCertSetting)

A value indicating the default root certificate trust settings when used as a certificate object in a trust settings API function.

[`SecTrustSettingsKeyUsage`](/documentation/Security/SecTrustSettingsKeyUsage)

Allowed uses for the encryption key in a certificate.

[`SecTrustSettingsResult`](/documentation/Security/SecTrustSettingsResult)

Trust settings returned in usage constraints dictionaries.

[`SecTrustSettingsDomain`](/documentation/Security/SecTrustSettingsDomain)

The trust settings domains.

### Legacy Symbols

[`SecTrustEvaluate(_:_:)`](/documentation/Security/SecTrustEvaluate(_:_:))

Evaluates trust for the specified certificate and policies.

[`SecTrustEvaluateAsync(_:_:_:)`](/documentation/Security/SecTrustEvaluateAsync(_:_:_:))

Evaluates a trust object asynchronously on the specified dispatch queue.

[`SecTrustCallback`](/documentation/Security/SecTrustCallback)

A block called with the results of an asynchronous trust evaluation.

[`SecTrustUserSetting`](/documentation/Security/SecTrustUserSetting)

Represents user-specified trust settings.

[`SecTrustSetParameters`](/documentation/Security/SecTrustSetParameters)

Sets the action and action data for a trust management object.

[`SecTrustSetKeychains(_:_:)`](/documentation/Security/SecTrustSetKeychains(_:_:))

Sets the keychains searched for intermediate certificates when evaluating a trust management object.

[`SecTrustGetCssmResult`](/documentation/Security/SecTrustGetCssmResult)

Retrieves the CSSM trust result.

[`SecTrustGetCssmResultCode`](/documentation/Security/SecTrustGetCssmResultCode)

Retrieves the CSSM result code from the most recent trust evaluation for a trust management object.

[`SecTrustGetTPHandle`](/documentation/Security/SecTrustGetTPHandle)

Retrieves the trust policy handle.

[`SecTrustGetResult`](/documentation/Security/SecTrustGetResult)

Retrieves details on the outcome of a call to the function `SecTrustEvaluate`.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)