module

Beryl::TLS::Messages::ExtensionCodec

Reads and writes the contents of each extension Beryl understands. Every reader consumes its whole input or raises decode_error.

Class methods

decode_certificate_authorities(contents : Bytes) : Array(Bytes)

certificate_authorities (RFC 9846 §4.2.4): a non-empty two-byte vector of DER distinguished names, each non-empty. Returns the names.

Source
decode_client_key_shares(contents : Bytes) : Array(KeyShareEntry)

key_share in a ClientHello. Two shares for one group are refused (§4.2.8).

Source
decode_client_pre_shared_key(contents : Bytes) : Tuple(Array(PskIdentity), Array(Bytes))

pre_shared_key in a ClientHello (§4.2.11): identities and binders, as many of each.

Source
decode_client_supported_versions(contents : Bytes) : Array(UInt16)

supported_versions in a ClientHello: a one-byte vector of versions.

Source
decode_protocol_names(contents : Bytes) : Array(String)

application_layer_protocol_negotiation (RFC 7301 §3.1): the names, none empty.

Source
decode_psk_modes(contents : Bytes) : Bytes

psk_key_exchange_modes.

Source
decode_record_size_limit(contents : Bytes) : Int32

record_size_limit (RFC 8449 §4): a value below 64 is refused.

Source
decode_selected_group(contents : Bytes) : UInt16

key_share in a HelloRetryRequest: the selected group.

Source
decode_selected_identity(contents : Bytes) : UInt16

pre_shared_key in a ServerHello: the selected identity.

Source
decode_selected_version(contents : Bytes) : UInt16

supported_versions in a ServerHello: the selected version.

Source
decode_server_key_share(contents : Bytes) : KeyShareEntry

key_share in a ServerHello: one entry.

Source
decode_server_name(contents : Bytes) : String | Nil

server_name (RFC 6066 §3): the host_name, or nil for an empty extension (the server's acknowledgement). Only one host_name entry may appear.

Source
decode_u16_list(contents : Bytes) : Array(UInt16)

A list of two-byte values in a two-byte vector: supported_groups, signature_algorithms, signature_algorithms_cert.

Source
encode_certificate_authorities(list_of_names : Array(Bytes)) : Bytes

certificate_authorities (§4.2.4): DER distinguished names, each in a two-byte vector, in a two-byte vector.

Source
encode_client_key_shares(list_of_entries : Array(KeyShareEntry)) : Bytes
Source
encode_client_pre_shared_key(list_of_identities : Array(PskIdentity), list_of_binders : Array(Bytes)) : Bytes
Source
encode_client_supported_versions(list_of_versions : Array(UInt16)) : Bytes
Source
encode_protocol_names(list_of_names : Array(String)) : Bytes
Source
encode_psk_modes(modes : Bytes) : Bytes
Source
encode_record_size_limit(limit : Int32) : Bytes
Source
encode_selected_group(group : UInt16) : Bytes
Source
encode_selected_identity(index : Int) : Bytes
Source
encode_selected_version(version : UInt16) : Bytes
Source
encode_server_key_share(entry : KeyShareEntry) : Bytes
Source
encode_server_name(host_name : String) : Bytes
Source
encode_u16_list(list_of_values : Array(UInt16)) : Bytes
Source

Nested types