SSL.Protocol.InnerPlaintext (ex_ssl v0.16.7)

Copy Markdown View Source

Bounded TLS 1.3 inner plaintext encoding and decoding.

The final nonzero byte carries the real record content type. Any bytes after it must be zero padding.

Summary

Types

content_type()

@type content_type() :: :alert | :handshake | :application_data

Functions

decode(plaintext)

@spec decode(term()) ::
  {:error,
   :empty_inner_plaintext
   | :missing_inner_content_type
   | {:empty_content, :alert | :application_data | :handshake}
   | {:invalid_inner_plaintext, :not_binary}
   | {:unsupported_inner_content_type, 1..255}
   | {:content_length_exceeded, non_neg_integer(), 16384}
   | {:inner_plaintext_length_exceeded, non_neg_integer(), 16385}}
  | {:ok, :alert | :application_data | :handshake, binary(), non_neg_integer()}

encode(content, content_type, padding_length \\ 0)

@spec encode(term(), term(), term()) :: {:ok, binary()} | {:error, term()}