Quic.Protection (elixir_quic v0.16.7)

Copy Markdown View Source

QUIC v1 Initial packet protection primitives.

Summary

Functions

aead_decrypt(key, iv, packet_number, aad, ciphertext, algorithm \\ :aes_128_gcm)

aead_encrypt(key, iv, packet_number, aad, plaintext, algorithm \\ :aes_128_gcm)

header_protection_mask(hp, sample, algorithm)

@spec header_protection_mask(
  binary(),
  binary(),
  :aes_128_gcm | :aes_256_gcm | :chacha20_poly1305
) ::
  {:ok, binary()} | {:error, atom()}

initial_secrets(dcid, role)

@spec initial_secrets(binary(), :client | :server) :: {:ok, map()} | {:error, atom()}

packet_keys(level, cipher_suite, aead, hkdf, secret)

@spec packet_keys(atom(), non_neg_integer(), atom(), atom(), binary()) ::
  {:ok, map()} | {:error, term()}

Derive QUIC Handshake/Application packet protection keys from a TLS secret.

remove_header_protection(packet, pn_offset, hp, algorithm)

@spec remove_header_protection(
  binary(),
  non_neg_integer(),
  binary(),
  :aes_128_gcm | :chacha20_poly1305
) ::
  {:ok, binary(), non_neg_integer()} | {:error, atom()}

Removes QUIC header protection from a packet prefix and packet number bytes.

retry_tag(original_dcid, retry_packet)

@spec retry_tag(binary(), binary()) :: {:ok, binary()} | {:error, atom()}

validate_retry(original_dcid, packet)

@spec validate_retry(binary(), binary()) :: :ok | {:error, atom()}