ktor-network-tls / io.ktor.network.tls / TLSConfigBuilder

TLSConfigBuilder

expect class TLSConfigBuilder

TLSConfig builder.

Constructors

<init>

TLSConfigBuilder()

TLSConfig builder.

Properties

certificates

val certificates: MutableList<CertificateAndKey>

List of client certificate chains with private keys.

cipherSuites

var cipherSuites: List<CipherSuite>

List of allowed CipherSuites.

random

var random: SecureRandom?

SecureRandom to use in encryption.

serverName

var serverName: String?

Custom server name for TLS server name extension. See also: https://en.wikipedia.org/wiki/Server_Name_Indication

trustManager

var trustManager: TrustManager?

Custom X509TrustManager to verify server authority.

Functions

build

fun build(): TLSConfig

Create TLSConfig.

Extension Functions

addCertificateChain

fun TLSConfigBuilder.addCertificateChain(chain: Array<X509Certificate>, key: PrivateKey): Unit

Add client certificate chain to use.

addKeyStore

fun TLSConfigBuilder.addKeyStore(store: KeyStore, password: CharArray): Unit

Add client certificates from store by using all certificates

fun TLSConfigBuilder.addKeyStore(store: KeyStore, password: CharArray, alias: String? = null): Unit

Add client certificates from store by using the certificate with specific alias or all certificates, if alias is null.

takeFrom

expect fun TLSConfigBuilder.takeFrom(other: TLSConfigBuilder): Unit

Append config from other builder.