Contents

init(forTrust:)

Creates a URL credential instance for server trust authentication with a given accepted trust.

Declaration

init(forTrust trust: SecTrust)

Parameters

  • trust:

    The accepted trust.

Return Value

A new URL credential object, containing the accepted server trust.

Discussion

Before creating a server trust credential, it is the responsibility of the delegate of an NSURLConnection instance or an NSURLDownload instance to evaluate the trust. Do this by calling SecTrustEvaluate(_:_:), passing it the trust obtained from the serverTrust method of the server’s URLProtectionSpace instance. If the trust is invalid, the authentication challenge should be cancelled with cancel(_:).

See Also

Creating a credential