ServerTrustEvaluating
public protocol ServerTrustEvaluating : Sendable
A protocol describing the API used to evaluate server trusts.
-
Evaluates the given
SecTrustvalue for the givenhost.Declaration
Swift
func evaluate(_ trust: SecTrust, forHost host: String) throwsParameters
trustThe
SecTrustvalue to evaluate.hostThe host for which to evaluate the
SecTrustvalue.Return Value
A
Boolindicating whether the evaluator considers theSecTrustvalue valid forhost.
-
revocationCheckingExtension methodProvides a default
RevocationTrustEvaluatorinstance.Declaration
Swift
public static var revocationChecking: RevocationTrustEvaluator { get } -
revocationChecking(performDefaultValidation:Extension methodvalidateHost: options: ) Creates a
RevocationTrustEvaluatorusing the provided parameters.Note
Default and host validation will fail when using this evaluator with self-signed certificates. Use
PinnedCertificatesTrustEvaluatorif you need to use self-signed certificates.Declaration
Swift
public static func revocationChecking(performDefaultValidation: Bool = true, validateHost: Bool = true, options: RevocationTrustEvaluator.Options = .any) -> RevocationTrustEvaluatorParameters
performDefaultValidationDetermines whether default validation should be performed in addition to evaluating the pinned certificates.
trueby default.validateHostDetermines whether or not the evaluator should validate the host, in addition to performing the default evaluation, even if
performDefaultValidationisfalse.trueby default.optionsThe
Optionsto use to check the revocation status of the certificate..anyby default.Return Value
-
pinnedCertificatesExtension methodProvides a default
PinnedCertificatesTrustEvaluatorinstance.Declaration
Swift
public static var pinnedCertificates: PinnedCertificatesTrustEvaluator { get } -
pinnedCertificates(certificates:Extension methodacceptSelfSignedCertificates: performDefaultValidation: validateHost: ) Creates a
PinnedCertificatesTrustEvaluatorusing the provided parameters.Declaration
Swift
public static func pinnedCertificates(certificates: [SecCertificate] = Bundle.main.af.certificates, acceptSelfSignedCertificates: Bool = false, performDefaultValidation: Bool = true, validateHost: Bool = true) -> PinnedCertificatesTrustEvaluatorParameters
certificatesThe certificates to use to evaluate the trust. All
cer,crt, anddercertificates inBundle.mainby default.acceptSelfSignedCertificatesAdds the provided certificates as anchors for the trust evaluation, allowing self-signed certificates to pass.
falseby default. THIS SETTING SHOULD BE FALSE IN PRODUCTION!performDefaultValidationDetermines whether default validation should be performed in addition to evaluating the pinned certificates.
trueby default.validateHostDetermines whether or not the evaluator should validate the host, in addition to performing the default evaluation, even if
performDefaultValidationisfalse.trueby default.
-
publicKeysExtension methodProvides a default
PublicKeysTrustEvaluatorinstance.Declaration
Swift
public static var publicKeys: PublicKeysTrustEvaluator { get } -
publicKeys(keys:Extension methodperformDefaultValidation: validateHost: ) Creates a
PublicKeysTrustEvaluatorfrom the provided parameters.Note
Default and host validation will fail when using this evaluator with self-signed certificates. Use
PinnedCertificatesTrustEvaluatorif you need to use self-signed certificates.Declaration
Swift
public static func publicKeys(keys: [SecKey] = Bundle.main.af.publicKeys, performDefaultValidation: Bool = true, validateHost: Bool = true) -> PublicKeysTrustEvaluatorParameters
keysThe
SecKeys to use to validate public keys. Defaults to the public keys of all certificates included in the main bundle.performDefaultValidationDetermines whether default validation should be performed in addition to evaluating the pinned certificates.
trueby default.validateHostDetermines whether or not the evaluator should validate the host, in addition to performing the default evaluation, even if
performDefaultValidationisfalse.trueby default.
-
composite(evaluators:Extension method) Creates a
CompositeTrustEvaluatorfrom the provided evaluators.Declaration
Swift
public static func composite(evaluators: [any ServerTrustEvaluating]) -> CompositeTrustEvaluatorParameters
evaluatorsThe
ServerTrustEvaluatingvalues used to evaluate the server trust.
View on GitHub
Install in Dash