Class TlsConfig

java.lang.Object
io.github.mahmoudimus.quic.tls.TlsConfig

public final class TlsConfig extends Object
Configuration for TLS 1.3 handshakes in QUIC, shared by any number of TlsSessions. A client needs a server name and ALPN protocols; a server needs a certificate (or a selector that picks one per server name) and ALPN protocols or an ALPN selector. Built with builder(); instances are immutable.

Defaults: all three cipher suites; the groups X25519, P-256 and P-384, in that order of preference; the signature schemes ecdsa_secp256r1_sha256, ecdsa_secp384r1_sha384, rsa_pss_rsae_sha256/384/512 and ed25519; the JDK's default trust manager with host name verification; no client authentication; no session tickets and no 0-RTT.

Resumption. A server with a ticketer sends tickets after each handshake and accepts them for PSK resumption (psk_dhe_ke only: a resumed handshake still does a fresh (EC)DHE exchange). A client resumes with a SessionTicket the connection layer passes to TlsSession.client(TlsConfig, String, byte[], SessionTicket). With earlyData, a client offers 0-RTT data when its ticket allows it, and a server allows 0-RTT in its tickets and accepts it when its policy does; see EarlyDataPolicy for the replay risk.

  • Field Details

    • DEFAULT_MAX_HANDSHAKE_MESSAGE_SIZE

      public static final int DEFAULT_MAX_HANDSHAKE_MESSAGE_SIZE
      The default limit on a handshake message body: 64 KiB.
      See Also:
  • Method Details

    • earlyData

      public boolean earlyData()
      Whether 0-RTT is enabled: offered by a client, allowed and accepted by a server.
      Returns:
      true if enabled
    • serverName

      public String serverName()
      Client: the server name to connect to when none is given.
      Returns:
      the name, or null
    • ticketer

      public Ticketer ticketer()
      The server's ticketer.
      Returns:
      the ticketer, or null if the server issues no tickets
    • builder

      public static TlsConfig.Builder builder()
      Starts a configuration with the defaults.
      Returns:
      a new builder