abla/tls/pure/resume

Generated from source.

Import with import "abla/tls/pure/resume".

Source: abla/tls/pure/resume/entry.ab

TLS_TICKET_MAXIMUM_LIFETIME (val)

val TLS_TICKET_MAXIMUM_LIFETIME

The longest a ticket may live (RFC 8446 section 4.6.1: seven days).

TlsTicketKey (class)

class TlsTicketKey(val name: string, val key: string, val created: int, val retired: int)

One ticket key: its name (16 random bytes, sent in the clear in every ticket it seals), the AES-256 key, when it was made and, once replaced, when.

TLS_TICKET_ROTATE_AFTER (val)

val TLS_TICKET_ROTATE_AFTER

The default age after which the current ticket key is replaced when a ticket is next sealed (24 hours, as Go's crypto/tls does): a stolen ticket key opens every ticket it ever sealed, so a key that never changed would keep every resumption secret of the server's life in reach of one disclosure. The retired key goes on opening the tickets it sealed until they expire (lifetime). OpenSSL's default is to never rotate; pass rotateAfter 0 for that.

TLS_TICKET_MAXIMUM_SEALS (val)

val TLS_TICKET_MAXIMUM_SEALS

The default number of tickets one key seals before a new key is made (2^24, the AES-GCM record limit of RFC 8446 section 5.5).

TlsTicketState (class)

class TlsTicketState(val ok: bool, val suite: int, val issued: int, val ageAdd: int, val psk: string, val alpn: string, val serverName: string)

What a ticket holds.

TlsTicketKeys (class)

class TlsTicketKeys(val seal: (int, int, string, string, string) -> string, val open: (string) -> TlsTicketState, val rotate: () -> bool,
    val wipe: () -> void, val now: () -> int, val lifetime: int, val count: int)

A server's ticket keys. seal makes the ticket for a session (suite, ticket_age_add, PSK, ALPN protocol, server name); open gives back what a ticket holds (a failed state for a ticket that is not ours, not authentic or malformed; the PSK of a good state is a buffer of its own for the caller to wipe); rotate makes a new current key (the old one stays to open the tickets it sealed, until they expire); wipe wipes every key; now is the clock the keys were made with. lifetime is the ticket_lifetime in seconds (at most 604800) and count the tickets sent per connection.

tlsTicketKeysNew (fun)

fun tlsTicketKeysNew(random: (int) -> string, now: () -> int, lifetime: int = 7200, count: int = 1, rotateAfter: int = TLS_TICKET_ROTATE_AFTER,
    maximumSeals: int = TLS_TICKET_MAXIMUM_SEALS): TlsTicketKeys

Ticket keys with one current key. random is the source (fresh bytes each call), now the clock in seconds, lifetime the ticket_lifetime (capped at seven days), count the tickets sent per connection, rotateAfter the age in seconds after which the current key is replaced when a ticket is next sealed (default TLS_TICKET_ROTATE_AFTER, 24 hours; 0: only rotate does it), maximumSeals the tickets one key seals before it is replaced (default TLS_TICKET_MAXIMUM_SEALS).

TlsStoredTicket (class)

class TlsStoredTicket(val host: string, val alpn: string, val suite: int, val ticket: string, val psk: string, val ageAdd: int,
    val lifetime: int, val received: int, val scope: string = "")

A ticket a client has received: the host and ALPN protocol of the connection, the suite, the ticket (the identity to offer), the PSK, the ticket_age_add, the lifetime the server gave (capped at seven days) and when it arrived.

TlsSessionCache (class)

class TlsSessionCache(val put: (string, string, int, string, string, int, int, string) -> void, val take: (string, array<string>, string) -> TlsStoredTicket?,
    val count: (string) -> int, val clear: () -> void, val now: () -> int)

The caller's cache of tickets, for any number of connections (give it to each TlsClientConfig.sessions). put keeps a ticket a connection to host (with ALPN protocol alpn, "" for none) received: ticket and PSK are copied into buffers of their own, the arguments are not touched, a lifetime of zero keeps nothing, and the oldest ticket goes when capacity is passed. take(host, offered) gives the newest unexpired ticket for host whose ALPN protocol the client still offers (offered: the protocols of its configuration; a ticket without one needs a client that offers none) and removes it, a ticket being used once; the caller owns its strings and wipes them. Expired tickets are wiped and dropped when met. count(host) is how many it holds, clear wipes and drops everything.

tlsSessionCacheNew (fun)

fun tlsSessionCacheNew(now: () -> int, capacity: int = 32): TlsSessionCache

A cache of at most capacity tickets; now is the clock in seconds.

Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.