Package io.github.mahmoudimus.quic.tls


package io.github.mahmoudimus.quic.tls
A TLS 1.3 handshake (RFC 8446) for QUIC (RFC 9001), client and server, ported from rustls with quinn's session interface. TlsSession is the entry point, configured by TlsConfig; cryptography comes from the JDK.

The JDK's SSLEngine cannot be used for QUIC: it emits TLS records, keeps the traffic secrets to itself and has no quic_transport_parameters extension. This package has no record layer: handshake messages are exchanged per encryption level and the secrets are handed to packet protection.

Session resumption and 0-RTT: a server seals tickets with a Ticketer, a client keeps them as SessionTickets in a ClientSessionStore, and a server's EarlyDataPolicy decides on early data, which can be replayed.

  • Class
    Description
    ClientHello profiles of real browsers, each checked against a capture of that browser.
    Decompresses a server's certificate chain (RFC 8879) with one of the algorithms a client offers in compress_certificate. zlib is built in (CertificateDecompressor.ZLIB); Brotli and zstd come from the caller, which has decoders for them.
    A certificate chain, end-entity certificate first, and the private key for that certificate: what a server, or a client asked for a certificate, presents and signs with.
    Whether a server asks clients for a certificate (RFC 8446 section 4.3.2).
    What a server's certificate and ALPN selectors see of a ClientHello.
    What a client's ClientHello looks like: its cipher suites, in order; its extensions, in order, with how each body is made; whether the extensions are shuffled per hello, as Chrome has done since version 110 (BoringSSL SSL_set_permute_extensions); the length of its legacy_session_id. A HelloContext supplies what changes per connection.
    A bounded, in-memory ClientSessionStore: up to a number of servers, each with up to 8 tickets.
    Where a client keeps session tickets between connections, by server.
    A resuming client's offer of 0-RTT data, as an EarlyDataPolicy sees it.
    Decides, on a server, whether to accept the 0-RTT data a resuming client offers.
    Where a client finds a server's Encrypted Client Hello configurations (RFC 9849): typically the ech parameter of the server's DNS HTTPS record (RFC 9848), looked up however the application resolves names.
    A handshake that offered Encrypted Client Hello and that the server completed without it (RFC 9849 section 6.1.6): the server authenticated as the configuration's public name, and the client then ended the connection with the ech_required alert.
    One extension of a ClientHelloProfile: its type, and how its body is made for a connection.
    Makes an extension's body for one hello.
    A body made from the rest of the hello, as Firefox's GREASE ECH is sized from the inner hello it would encrypt: encoded after the other extensions' bodies.
    A socket of a FingerprintSslContext: the ClientHello profile it presents, and what the context was given to go with it (FingerprintSslContext.Builder.attach(java.lang.Object)), such as the HTTP/2 fingerprint for connections over it.
    An SSLContext for TLS clients that present a browser's fingerprint: its sockets' handshakes are a ClientHelloProfile's, such as BrowserProfiles.chrome156(), so a server sees that browser's ClientHello (cipher suites, extensions and their order, GREASE, key shares) where it would see the JDK's.
    Configures a FingerprintSslContext.
    The GREASE values (RFC 8701) one ClientHello uses, drawn per connection the way BoringSSL draws them: one for the cipher suites, one shared by the supported groups and the key shares, one for each of the two GREASE extensions (which must differ), one for the supported versions and one for the signature algorithms.
    What one ClientHello says that its profile does not: the server's name, the ALPN protocols offered on this connection, the public keys of the key shares, the GREASE values, and where the random bytes (client random, session id, GREASE ECH, shuffling) come from.
    The groups the handshake offers and accepts for key exchange (RFC 8446 section 4.2.7): (EC)DHE groups and the X25519MLKEM768 hybrid.
    The extensions browser profiles send, each as an ExtensionSpec whose body is encoded the way the browser encodes it (RFC 8446 section 4.2 and the extensions' own specifications).
    A session ticket a client received in a NewSessionTicket message (RFC 8446 section 4.6.1), with what it needs to resume the session: the pre-shared key derived from the resumption master secret, the cipher suite, the ticket age obfuscation, and for 0-RTT the ALPN protocol and the server's QUIC transport parameters, which a client must remember and use for its early data (RFC 9000 section 7.4.1).
    The signature schemes (RFC 8446 section 4.2.3) the handshake knows.
    A stateless session ticket encrypter for a server (RFC 8446 section 4.6.1, RFC 5077 section 4): the session state is sealed into the ticket with AES-256-GCM under a server key, so the server keeps nothing per session.
    The TLS 1.2 cipher suites browser profiles offer (RFC 5246, 5289, 7905): ECDHE with an ECDSA or RSA certificate, or RSA key transport; AES-GCM, ChaCha20-Poly1305 or AES-CBC with HMAC-SHA1.
    The TLS alert descriptions (RFC 8446 section 6) the handshake raises.
    Configuration for TLS 1.3 handshakes in QUIC, shared by any number of TlsSessions.
    Builds a TlsConfig.
    A TLS 1.3 handshake for QUIC (RFC 9001), as a sans-I/O state machine modelled on quinn's crypto::Session.