docs/Protocols/ServerTrustEvaluating.html
public protocol ServerTrustEvaluating : Sendable
A protocol describing the API used to evaluate server trusts.
`
evaluate(_:forHost:)
`
Evaluates the given SecTrust value for the given host.
Swift
func evaluate(_ trust: SecTrust, forHost host: String) throws
| trust |
The SecTrust value to evaluate.
|
| host |
The host for which to evaluate the SecTrust value.
|
A Bool indicating whether the evaluator considers the SecTrust value valid for host.
Self == RevocationTrustEvaluator`
revocationChecking
` Extension method
Provides a default RevocationTrustEvaluator instance.
Swift
public static var revocationChecking: RevocationTrustEvaluator { get }
`
revocationChecking(performDefaultValidation:validateHost:options:)
` Extension method
Creates a RevocationTrustEvaluator using the provided parameters.
Note
Default and host validation will fail when using this evaluator with self-signed certificates. Use PinnedCertificatesTrustEvaluator if you need to use self-signed certificates.
Swift
public static func revocationChecking(performDefaultValidation: Bool = true,
validateHost: Bool = true,
options: RevocationTrustEvaluator.Options = .any) -> RevocationTrustEvaluator
| performDefaultValidation |
Determines whether default validation should be performed in addition to evaluating the pinned certificates. true by default.
|
| validateHost |
Determines whether or not the evaluator should validate the host, in addition to performing the default evaluation, even if performDefaultValidation is false. true by default.
|
| options |
The Options to use to check the revocation status of the certificate. .any by default.
|
The RevocationTrustEvaluator.
Self == PinnedCertificatesTrustEvaluator`
pinnedCertificates
` Extension method
Provides a default PinnedCertificatesTrustEvaluator instance.
Swift
public static var pinnedCertificates: PinnedCertificatesTrustEvaluator { get }
`
pinnedCertificates(certificates:acceptSelfSignedCertificates:performDefaultValidation:validateHost:)
` Extension method
Creates a PinnedCertificatesTrustEvaluator using the provided parameters.
Swift
public static func pinnedCertificates(certificates: [SecCertificate] = Bundle.main.af.certificates,
acceptSelfSignedCertificates: Bool = false,
performDefaultValidation: Bool = true,
validateHost: Bool = true) -> PinnedCertificatesTrustEvaluator
| certificates |
The certificates to use to evaluate the trust. All cer, crt, and der certificates in Bundle.main by default.
|
| acceptSelfSignedCertificates |
Adds the provided certificates as anchors for the trust evaluation, allowing self-signed certificates to pass. false by default. THIS SETTING SHOULD BE FALSE IN PRODUCTION!
|
| performDefaultValidation |
Determines whether default validation should be performed in addition to evaluating the pinned certificates. true by default.
|
| validateHost |
Determines whether or not the evaluator should validate the host, in addition to performing the default evaluation, even if performDefaultValidation is false. true by default.
|
Self == PublicKeysTrustEvaluator`
publicKeys
` Extension method
Provides a default PublicKeysTrustEvaluator instance.
Swift
public static var publicKeys: PublicKeysTrustEvaluator { get }
`
publicKeys(keys:performDefaultValidation:validateHost:)
` Extension method
Creates a PublicKeysTrustEvaluator from the provided parameters.
Note
Default and host validation will fail when using this evaluator with self-signed certificates. Use PinnedCertificatesTrustEvaluator if you need to use self-signed certificates.
Swift
public static func publicKeys(keys: [SecKey] = Bundle.main.af.publicKeys,
performDefaultValidation: Bool = true,
validateHost: Bool = true) -> PublicKeysTrustEvaluator
| keys |
The SecKeys to use to validate public keys. Defaults to the public keys of all certificates included in the main bundle.
|
| performDefaultValidation |
Determines whether default validation should be performed in addition to evaluating the pinned certificates. true by default.
|
| validateHost |
Determines whether or not the evaluator should validate the host, in addition to performing the default evaluation, even if performDefaultValidation is false. true by default.
|
Self == CompositeTrustEvaluator`
composite(evaluators:)
` Extension method
Creates a CompositeTrustEvaluator from the provided evaluators.
Swift
public static func composite(evaluators: [any ServerTrustEvaluating]) -> CompositeTrustEvaluator
| evaluators |
The ServerTrustEvaluating values used to evaluate the server trust.
|