clientTlsContextBuilder

fun clientTlsContextBuilder(certChainFilePath: String = "", privateKeyFilePath: String = "", trustCertCollectionFilePath: String = ""): TlsContextBuilder

Creates a client-side TlsContextBuilder that can be further customized before building.

Supplying trustCertCollectionFilePath pins the servers to trust to that CA; leaving it empty keeps Netty's default trust manager, which verifies against the JVM trust store, as a server with a public-CA certificate needs. Supplying certChainFilePath and privateKeyFilePath together enables mutual auth; neither one is valid without the other.

Return

a TlsContextBuilder wrapping the configured SslContextBuilder

Parameters

certChainFilePath

path to the client certificate chain file (for mutual auth)

privateKeyFilePath

path to the client private key file (for mutual auth)

trustCertCollectionFilePath

path to the trusted CA certificates file; when empty, the JVM's default trust store is used

Throws

if SSL context builder creation fails

if a given file does not exist, or only one of the cert/key pair is given