<!--
{
  "availability" : [
    "iOS: 9.0.0 - 18.0.0",
    "iPadOS: 9.0.0 - 18.0.0",
    "macCatalyst: 13.1.0 - 18.0.0",
    "macOS: 10.11.0 - 15.0.0",
    "tvOS: 17.0.0 - 18.0.0",
    "visionOS: 1.0.0 - 2.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "NetworkExtension",
  "identifier" : "/documentation/NetworkExtension/NWTCPConnectionAuthenticationDelegate/evaluateTrust(for:peerCertificateChain:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Network Extension"
    ],
    "preciseIdentifier" : "c:objc(pl)NWTCPConnectionAuthenticationDelegate(im)evaluateTrustForConnection:peerCertificateChain:completionHandler:"
  },
  "title" : "evaluateTrust(for:peerCertificateChain:completionHandler:)"
}
-->

# evaluateTrust(for:peerCertificateChain:completionHandler:)

Override the default trust evaluation for the connection.

```
optional func evaluateTrust(for connection: NWTCPConnection, peerCertificateChain: [Any], completionHandler completion: @escaping (SecTrust) -> Void)
```

## Parameters

`connection`

The connection sending this message

`peerCertificateChain`

The connection peer’s certificate chain

`completion`

The completion handler for passing the <doc://com.apple.documentation/documentation/Security/SecTrust> object to the connection. The `SecTrustRef` object `trust` is required and must not be `nil`. It will be evaluated using <doc://com.apple.documentation/documentation/Security/SecTrustEvaluate(_:_:)> if necessary.

    The caller is responsible for keeping the argument object valid for the duration of the completion handler invocation.

## Discussion

The caller can implement this optional protocol method to set up custom policies for peer certificate trust evaluation. If the delegate method is implemented, the caller is responsible for creating and setting up the <doc://com.apple.documentation/documentation/Security/SecTrust> object and passing it to the completion handler. Otherwise, the default trust evaluation policy is used for the connection.

---

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)