Override the default trust evaluation for the connection
SDKs
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
Framework
- Network
Extension
Declaration
optional func evaluateTrust(for connection: NWTCPConnection, peerCertificateChain: [Any], completionHandler completion: @escaping (Sec Trust) -> Void)
Parameters
connection
The connection sending this message
peerCertificateChain
The connection peer’s certificate chain
completionHandler
The completion handler for passing the
Sec
object to the connection. TheTrust Sec
objectTrust Ref trust
is required and must not benil
. It will be evaluated usingSec
if necessary.Trust Evaluate(_: _:) 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 Sec
object and passing it to the completion handler. Otherwise, the default trust evaluation policy is used for the connection.