Package io.ktor.network.tls

Types

Link copied to clipboard
class CertificateAndKey(certificateChain: Array<X509Certificate>, key: PrivateKey)

Client certificate chain with private key.

Link copied to clipboard
object CIOCipherSuites

CIO cipher suites collection https://www.ietf.org/rfc/rfc5289.txt https://tools.ietf.org/html/rfc5288#section-3

Link copied to clipboard
data class CipherSuite(code: Short, name: String, openSSLName: String, exchangeType: SecretExchangeType, jdkCipherName: String, keyStrength: Int, fixedIvLength: Int, ivLength: Int, cipherTagSizeInBytes: Int, macName: String, macStrength: Int, hash: HashAlgorithm, signatureAlgorithm: SignatureAlgorithm, cipherType: CipherType)

Represents a TLS cipher suite

Link copied to clipboard
enum CipherType : Enum<CipherType>

Cipher type.

Link copied to clipboard
class NoPrivateKeyException(alias: String, store: KeyStore) : IllegalStateException, CopyableThrowable<NoPrivateKeyException>

Throws if failed to find PrivateKey for any alias in KeyStore.

Link copied to clipboard
data class OID(identifier: String)
Link copied to clipboard
enum SecretExchangeType : Enum<SecretExchangeType>

TLS secret key exchange type.

Link copied to clipboard
enum ServerKeyExchangeType : Enum<ServerKeyExchangeType>

Server key exchange type with it's code

Link copied to clipboard
enum TLSAlertLevel : Enum<TLSAlertLevel>

TLS alert level

Link copied to clipboard
enum TLSAlertType : Enum<TLSAlertType>

TLS alert types with codes

Link copied to clipboard
expect class TLSConfig
actual class TLSConfig

TLS configuration.

actual class TLSConfig
Link copied to clipboard
expect class TLSConfigBuilder

TLSConfig builder.

actual class TLSConfigBuilder

TLSConfig builder.

actual class TLSConfigBuilder

TLSConfig builder.

Link copied to clipboard
enum TLSHandshakeType : Enum<TLSHandshakeType>

TLS handshake record type

Link copied to clipboard
enum TLSRecordType : Enum<TLSRecordType>

TLS record type with it's numeric code

Link copied to clipboard
enum TLSVersion : Enum<TLSVersion>

TLS version

Functions

Link copied to clipboard
fun TLSConfigBuilder.addCertificateChain(chain: Array<X509Certificate>, key: PrivateKey)

Add client certificate chain to use.

Link copied to clipboard
fun TLSConfigBuilder.addKeyStore(store: KeyStore, password: CharArray)

Add client certificates from store by using all certificates

fun TLSConfigBuilder.addKeyStore(store: KeyStore, password: CharArray, alias: String? = null)
@JvmName(name = "addKeyStoreNullablePassword")
fun TLSConfigBuilder.addKeyStore(store: KeyStore, password: CharArray?, alias: String? = null)

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

Link copied to clipboard
fun keysGenerationAlgorithm(algorithm: String): String
Link copied to clipboard
expect fun TLSConfigBuilder.takeFrom(other: TLSConfigBuilder)

Append config from other builder.

actual fun TLSConfigBuilder.takeFrom(other: TLSConfigBuilder)

Append config from other builder.

actual fun TLSConfigBuilder.takeFrom(other: TLSConfigBuilder)

Append config from other builder.

Link copied to clipboard
suspend fun Connection.tls(coroutineContext: CoroutineContext): Socket
suspend fun Socket.tls(coroutineContext: CoroutineContext): Socket

Make Socket connection secure with TLS.

suspend fun Connection.tls(coroutineContext: CoroutineContext, config: TLSConfig): Socket
expect suspend fun Socket.tls(coroutineContext: CoroutineContext, config: TLSConfig): Socket

Make Socket connection secure with TLS using TLSConfig.

suspend fun Connection.tls(coroutineContext: CoroutineContext, block: TLSConfigBuilder.() -> Unit): Socket
expect suspend fun Socket.tls(coroutineContext: CoroutineContext, block: TLSConfigBuilder.() -> Unit): Socket

Make Socket connection secure with TLS configured with block.

actual suspend fun Socket.tls(coroutineContext: CoroutineContext, config: TLSConfig): Socket

Make Socket connection secure with TLS using TLSConfig.

actual suspend fun Socket.tls(coroutineContext: CoroutineContext, block: TLSConfigBuilder.() -> Unit): Socket

Make Socket connection secure with TLS configured with block.

suspend fun Socket.tls(coroutineContext: CoroutineContext, trustManager: X509TrustManager? = null, randomAlgorithm: String = "NativePRNGNonBlocking", cipherSuites: List<CipherSuite> = CIOCipherSuites.SupportedSuites, serverName: String? = null): Socket

Make Socket connection secure with TLS.