TlsOptions
class in package klyn.net

    public class TlsOptions extends Object:

Object
└ TlsOptions

Immutable TLS options for HTTP clients.

This value object carries peer-verification, trust-store and client certificate settings for HTTPS requests made through `HttpClient`.

    import klyn.net

    tls = TlsOptions.clientDefault().withTlsVersions("TLSv1.2", "TLSv1.3")
    print(tls.verifyPeer)

Fields

Modifier and Type | Member | Description
--- | --- | ---
public readonly | caFile `caFile as String` | Optional CA certificate file in PEM format.
public readonly | caPath `caPath as String` | Optional CA certificate folder.
public readonly | clientCertificateFile `clientCertificateFile as String` | Optional client certificate file in PEM format.
public readonly | clientPrivateKeyFile `clientPrivateKeyFile as String` | Optional client private key file in PEM format.
public readonly | maxVersion `maxVersion as String` | Optional maximum TLS version, for example `TLSv1.3`.
public readonly | minVersion `minVersion as String` | Optional minimum TLS version, for example `TLSv1.2`.
public readonly | verifyPeer `verifyPeer as Boolean` | True when peer certificates and host names must be verified.

Inherited Properties
property Inherited Properties from Object: type
Constructors

Modifier and Type | Member | Description
--- | --- | ---
public | TlsOptions `TlsOptions(verifyPeer as Boolean = true, caFile as String = "", caPath as String = "", clientCertificateFile as String = "", clientPrivateKeyFile as String = "", minVersion as String = "", maxVersion as String = ""):` | Creates a TLS configuration for HTTPS requests.

Methods

Modifier and Type | Member | Description
--- | --- | ---
public static | clientDefault `clientDefault() as TlsOptions:` | Returns the default verified TLS options.
public | copy `copy() as TlsOptions:` | Returns a copy of these TLS options.
public static | insecure `insecure() as TlsOptions:` | Returns insecure TLS options that disable peer verification.
public | trustAll `trustAll() as TlsOptions:` | Returns a copy that trusts all peers.
public | withCaFile `withCaFile(value as Object) as TlsOptions throws ProtocolException:` | Returns a copy with a custom CA certificate file.
public | withCaPath `withCaPath(value as Object) as TlsOptions throws ProtocolException:` | Returns a copy with a custom CA certificate directory.
public | withClientCertificate `withClientCertificate(certificatePath as Object, privateKeyPath as Object) as TlsOptions throws ProtocolException:` | Returns a copy with a client certificate and private key.
public | withTlsVersions `withTlsVersions(minVersion as String, maxVersion as String = "") as TlsOptions:` | Returns a copy with minimum and optional maximum TLS versions.

Inherited Methods
method Inherited Methods from Object: deepCopy, fromJson, toDict, toJson, toString, toXml