Class SessionTicket

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

public final class SessionTicket extends Object
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).

A ticket is meant to be used once (RFC 8446 appendix C.4): a ClientSessionStore hands each out once. Tickets hold secrets and live only in memory. Immutable.

  • Field Details

    • QUIC_MAX_EARLY_DATA

      public static final long QUIC_MAX_EARLY_DATA
      max_early_data_size in a ticket that allows QUIC 0-RTT (RFC 9001 section 4.6.1).
      See Also:
  • Method Details

    • serverName

      public String serverName()
      The server name the ticket is for, as the client sent it in SNI.
      Returns:
      the name, or null if the client sent none
    • cipherSuite

      public CipherSuite cipherSuite()
      The cipher suite of the session; a resumption must use one with the same hash, and 0-RTT this very suite.
      Returns:
      the suite
    • alpn

      public String alpn()
      The application protocol of the session, which 0-RTT data is sent for.
      Returns:
      the protocol
    • allowsEarlyData

      public boolean allowsEarlyData()
      Whether the ticket allows 0-RTT data.
      Returns:
      true if the server sent early_data with QUIC's max_early_data_size
    • transportParameters

      public byte[] transportParameters()
      The server's encoded QUIC transport parameters from the session the ticket came from. A client sending 0-RTT data must keep within their limits.
      Returns:
      a copy, or null if unknown
    • peerCertificates

      public List<X509Certificate> peerCertificates()
      The server's certificate chain from the full handshake the session started with.
      Returns:
      the chain, end-entity first
    • received

      public Instant received()
      When the client received the ticket.
      Returns:
      the time
    • lifetime

      public Duration lifetime()
      How long the server said the ticket may be used.
      Returns:
      the lifetime, at most 7 days
    • isExpired

      public boolean isExpired(Instant now)
      Whether the ticket has outlived its lifetime.
      Parameters:
      now - the current time
      Returns:
      true once it must no longer be offered
    • toString

      public String toString()
      Overrides:
      toString in class Object