ExIcaoVds.SignatureZone (ex_icao_vds v0.3.2)

Copy Markdown

VDS signature zone struct and binary encoder/decoder.

Binary format

<<0xFF, algorithm::8, sig_length::variable, signature::sig_length>>

The 0xFF marker immediately follows the message zone. The signed payload is everything before 0xFF (i.e. header bytes + message zone bytes).

Algorithm byte values

ValueMeaning
0x01ECDSA secp256r1 (P-256) / SHA-256, DER-encoded signature
0x02ECDSA secp384r1 (P-384) / SHA-384, DER-encoded signature

Summary

Functions

Returns the algorithm byte for the given algorithm atom.

Decodes a signature zone from bytes starting with 0xFF. Returns {:ok, signature_zone} or {:error, Error.t()}.

Encodes a SignatureZone into bytes. Returns {:ok, binary} or {:error, Error.t()}.

Types

t()

@type t() :: %ExIcaoVds.SignatureZone{
  algorithm: atom(),
  marker: non_neg_integer(),
  raw: binary() | nil,
  signature: binary(),
  signature_format: :der | :raw,
  signed_bytes: binary() | nil
}

Functions

algorithm_byte(algo)

@spec algorithm_byte(atom()) :: {:ok, byte()} | :error

Returns the algorithm byte for the given algorithm atom.

decode(arg1)

@spec decode(binary()) :: {:ok, t()} | {:error, ExIcaoVds.Error.t()}

Decodes a signature zone from bytes starting with 0xFF. Returns {:ok, signature_zone} or {:error, Error.t()}.

encode(signature_zone)

@spec encode(t()) :: {:ok, binary()} | {:error, ExIcaoVds.Error.t()}

Encodes a SignatureZone into bytes. Returns {:ok, binary} or {:error, Error.t()}.