Beryl::TLS::RecordProtection
One direction of record protection (RFC 9846 §5.2 and §5.3): the AEAD keyed from a traffic secret, its IV, and the sequence number.
protection = Beryl::TLS::RecordProtection.new(CipherSuite::TLS_AES_128_GCM_SHA256, traffic_secret)
record = protection.seal(ContentType::ApplicationData, "hello".to_slice)
protection_of_peer.open(record[0, 5], record[5..]) # => {ContentType::ApplicationData, Bytes}
Constants
The record header: type, legacy version, length.
The largest TLSCiphertext fragment (§5.2).
The largest TLSInnerPlaintext: 2^14 bytes of content and its type.
Constructors
Instance methods
Opens the record with header and ciphertext. Returns the inner
content type and content, or nil when the record fails
authentication; raises for a record with no content type.
Returns a whole protected record (header and ciphertext) carrying content of content_type, with padding_bytesize zero bytes of padding (§5.4).
Wipes the key material this direction holds: the AEAD's key and
everything derived from it, the IV and the last nonce. A wiped
direction raises Crypto::KeyWiped on seal and open.