struct

Beryl::TLS::SealedSessionState

Inherits Struct < Value < Object

What a server seals into a session ticket, and reads back when a client offers it (RFC 9846 §4.6.1, §4.2.11). The server keeps no state: the ticket is XChaCha20-Poly1305 under the context's ticket key.

A session whose client sent a certificate keeps that chain in its tickets, so a resumed connection has the same peer certificate. A server that asks for client certificates verifies the chain again when it resumes, and one that requires a certificate resumes only a session that had one.

Constants

ASSOCIATED_DATA = "beryl tls13 session ticket"

Authenticated with every ticket, so a ticket key used elsewhere cannot be confused with this one.

FORMAT_VERSION = 2_u8

A version byte at the front, so a later format can coexist. Version 2 added the client's certificate chain; a version 1 ticket is not opened, and its client gets a full handshake.

LARGEST_PEER_CERTIFICATES_BYTESIZE = 32768

The most bytes of client certificates a ticket carries. A server sends no tickets after a handshake whose client chain is larger, so every ticket stays well inside NewSessionTicket's two-byte length.

LONGEST_LIFETIME_SECONDS = 604800_u32

The longest lifetime RFC 9846 §4.6.1 allows: seven days.

Constructors

new(cipher_suite : Beryl::TLS::CipherSuite, resumption_pre_shared_key : Slice(UInt8), issued_at_unix_milliseconds : Int64, lifetime_seconds : UInt32, ticket_age_add : UInt32, alpn_protocol : Nil | String, server_name : Nil | String, list_of_peer_certificate_data : Array(Slice(UInt8)) = [] of Bytes)
Source

Class methods

open(ticket : Bytes, ticket_key : Bytes) : SealedSessionState | Nil

Returns the state sealed in ticket, or nil for a ticket this key did not seal or that does not parse.

Source

Instance methods

alpn_protocol
Source
cipher_suite
Source
issued_at_unix_milliseconds
Source
lifetime_seconds
Source
list_of_peer_certificate_data

The DER of the client's certificate chain, leaf first; empty when the client sent none.

Source
resumption_pre_shared_key
Source
seal(ticket_key : Bytes) : Bytes

Returns the sealed ticket.

Source
server_name
Source
ticket_age_add
Source