class

Beryl::TLS::TranscriptHash

Inherits Reference < Object

The handshake transcript (RFC 9846 §4.4.1): every handshake message, header included, in the order sent and received.

The messages are kept as bytes until the handshake ends, so that the hash can be chosen after the ServerHello names the suite, and so that the first ClientHello can be replaced by its message_hash when a HelloRetryRequest arrives. A handshake transcript is a few kilobytes (each message is capped at 64 KiB by the record layer), and the hash is taken about eight times per handshake.

Constructors

Instance methods

add(message : Bytes) : Nil

Appends one whole handshake message.

Source
bytesize
Source
clear

Drops the stored messages once the handshake no longer needs them.

Source
digest(hash_algorithm : HashAlgorithm) : Bytes

Returns the transcript hash of every message added.

Source
digest_with(extra : Bytes, hash_algorithm : HashAlgorithm) : Bytes

Returns the transcript hash as if extra had been added, without adding it (the PSK binder hashes a ClientHello cut before its binders, RFC 9846 §4.2.11.2).

Source
replace_with_message_hash(hash_algorithm : HashAlgorithm) : Nil

Replaces the transcript, which must hold exactly the first ClientHello, by the synthetic message_hash message that stands for it after a HelloRetryRequest (RFC 9846 §4.4.1).

Source