---
title: "SecTrustEvaluateAsyncWithError(_:_:_:)"
framework: security
role: symbol
role_heading: Function
path: "security/sectrustevaluateasyncwitherror(_:_:_:)"
---

# SecTrustEvaluateAsyncWithError(_:_:_:)

Evaluates a trust object asynchronously on the specified dispatch queue.

## Declaration

```swift
func SecTrustEvaluateAsyncWithError(_ trust: SecTrust, _ queue: dispatch_queue_t, _ result: @escaping SecTrustWithErrorCallback) -> OSStatus
```

## Parameters

- `trust`: The trust management object 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 doc://com.apple.security/documentation/Security/SecTrustCreateWithCertificates(_:_:_:) function to create a trust management object.
- `queue`: The dispatch queue on which the result block should execute. You must call the method from the same queue.
- `result`: A closure that the method calls to report the result of trust evaluation. The method calls the closure exactly once if the method returns doc://com.apple.security/documentation/Security/errSecSuccess, and not at all otherwise. The method might call the closure synchronously in some cases, before returning.

## Mentioned in

Evaluating a Trust and Parsing the Result

## Return Value

Return Value A result code. See Security Framework Result Codes.

## Discussion

Discussion This method behaves like SecTrustEvaluateWithError(_:_:), except that it provides an evaluation by calling the given closure. The method might do this synchronously before returning if the trust instance already contains a result. Otherwise, the method returns immediately, performs the evaluation asynchronously, and calls the closure with the result later. important: You must call this method from the same dispatch queue that you specify as the queue parameter.
