CLASS

ClientAuthenticationMethodMTLS

Contents

public final class ClientAuthenticationMethodMTLS: NSObject, ClientAuthenticationMethod

Mutual TLS client authentication with server pinning.

The client identity from a PKCS#12 file is presented when the server asks for it. The server is accepted only when the platform validates its certificate chain and a certificate of that chain matches the configured pin; requests to non-https URLs are refused. Details, defaults and diagnostics: the "Server pinning" section of the IdsvrHaapiDriver documentation.

Methods

init(pkcs12Filename:pkcs12Passphrase:serverPEMFilename:isValidatingHostname:bundle:)

@objc public convenience init(pkcs12Filename: String,
                              pkcs12Passphrase: String,
                              serverPEMFilename: String,
                              isValidatingHostname: Bool,
                              bundle: Bundle = Bundle.main) throws

Creates a mutual TLS client authentication method that pins a server certificate from a PEM file.

Parameters

Name Description
pkcs12Filename The PKCS#12 file holding the client identity, without the .p12 extension.
pkcs12Passphrase The passphrase of the PKCS#12 file.
serverPEMFilename The PEM file holding the certificate to pin, without the .pem extension.
isValidatingHostname Whether the server’s certificate must name the connection host. false skips only that check; the chain is still validated and the pin must then be the server’s own certificate.
bundle The bundle holding both files. Bundle.main is the default value.

init(pkcs12Filename:pkcs12Passphrase:serverKeyPinnings:bundle:)

@objc public convenience init(pkcs12Filename: String,
                              pkcs12Passphrase: String,
                              serverKeyPinnings: [KeyPinning],
                              bundle: Bundle = Bundle.main) throws

Creates a mutual TLS client authentication method that pins server public keys per host.

Parameters

Name Description
pkcs12Filename The PKCS#12 file holding the client identity, without the .p12 extension.
pkcs12Passphrase The passphrase of the PKCS#12 file.
serverKeyPinnings The pins, one or more per host.
bundle The bundle holding the PKCS#12 file. Bundle.main is the default value.