SSL.Protocol.ServerHello (ex_ssl v0.16.7)

Copy Markdown View Source

Pure, bounded decoder for TLS 1.3 ServerHello and HelloRetryRequest messages.

The input starts at a handshake header. A successful decode retains the exact consumed bytes and returns any concatenated handshake bytes as the remainder.

Summary

Types

expectations()

@type expectations() :: %{
  :legacy_session_id => binary(),
  optional(:offered_versions) => [0..65535],
  :offered_ciphers => [0..65535],
  :offered_groups => [0..65535],
  :offered_key_share_groups => [0..65535],
  :offered_extension_ids => [0..65535],
  :offered_psk_key_exchange_modes => [0 | 1],
  optional(:offered_psk_count) => non_neg_integer()
}

extension()

@type extension() ::
  {:supported_versions, 772}
  | {:key_share, %{group: 0..65535, key_exchange: binary()}}
  | {:selected_group, 0..65535}
  | {:pre_shared_key, non_neg_integer()}
  | {:cookie, binary()}

kind()

@type kind() :: :server_hello | :hello_retry_request

t()

@type t() :: %SSL.Protocol.ServerHello{
  cipher_suite: 0..65535,
  compression_method: 0,
  encoded: binary(),
  extensions: [extension()],
  kind: kind(),
  legacy_session_id_echo: binary(),
  legacy_version: 771,
  random: binary()
}

Functions

decode(input, expectations, opts \\ [])

@spec decode(term(), term(), keyword()) ::
  {:ok, t(), binary()} | {:more, non_neg_integer()} | {:error, term()}