<!--
{
  "documentType" : "article",
  "framework" : "Security",
  "identifier" : "/documentation/Security/discovering-why-a-trust-evaluation-failed",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "Discovering Why a Trust Evaluation Failed"
}
-->

# Discovering Why a Trust Evaluation Failed

Determine whether you can recover from a failed trust evaluation.

## Discussion

Many factors affect the outcome of a trust evaluation. These include whether the system can locate all of the intermediate certificates, the validity of the certificates in the chain, and the characteristics of the certificates. Some issues, like a revoked certificate, result in an absolute failure and should *not* be circumvented. In other cases, you might get a different result by changing the conditions of the evaluation. For example, an expired certificate might have been valid when the corresponding identity was used to sign a document.

To get the specific reason for trust failure, examine the error parameter provided in the evaluation callback described in [Evaluating a Trust and Parsing the Result](/documentation/Security/evaluating-a-trust-and-parsing-the-result). The error’s code indicates the reason, or in the case of multiple errors, the most serious reason for the failure. For example, a revoked certificate results in an error with the code [`errSecCertificateRevoked`](/documentation/Security/errSecCertificateRevoked), while an expired certificate produces [`errSecCertificateExpired`](/documentation/Security/errSecCertificateExpired).

To determine whether the system considers the failure recoverable, use the [`SecTrustGetTrustResult(_:_:)`](/documentation/Security/SecTrustGetTrustResult(_:_:)) method.

```objc
SecTrustResultType trustResult;
SecTrustGetTrustResult(trust, &trustResult);
if (trustResult == kSecTrustResultRecoverableTrustFailure) {
    // Make changes and try again.
}
```

For a result of [`SecTrustResultType.recoverableTrustFailure`](/documentation/Security/SecTrustResultType/recoverableTrustFailure), and based on the error you receive, you may be able to remedy problems by reconfiguring and reevaluating the trust, as described in [Configuring a Trust](/documentation/Security/configuring-a-trust).

---

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)