ExIcaoVds.Encryptor behaviour
(ex_icao_vds v0.3.2)
Copy Markdown
Behaviour for optional field-level encryption inside the VDS message zone.
VDS provides authenticity and integrity — not confidentiality. Encryption is an optional extra layer applied inside a feature value before the feature is included in the signed message zone.
The signed payload therefore covers the ciphertext, ensuring that any tampering with the encrypted data breaks signature verification.
Encryption ordering
normalize → encode public fields → encrypt sensitive fields
→ canonicalize header + message zone → sign → render carrierCallbacks
encrypt_field/5— encrypt a single field value; returns encoded bytes ready to be stored asencoded_valuein theFeaturestructdecrypt_field/5— decrypt a single field value; returns the decoded termmode/1— encryption mode atom (e.g.:hpke,:none)algorithms/1— map describing algorithm suite in use
Summary
Callbacks
Return a map describing the algorithm suite in use.
Decrypt an encrypted field value.
Encrypt the given plaintext bytes for field.
Return the encryption mode atom (e.g. :hpke, :none).
Callbacks
Return a map describing the algorithm suite in use.
@callback decrypt_field( field :: map(), encrypted_value :: binary(), key_store :: map(), profile :: module() | nil, opts :: keyword() ) :: {:ok, term()} | {:error, ExIcaoVds.Error.t()}
Decrypt an encrypted field value.
field— field definition mapencrypted_value— bytes from the decodedFeature.encoded_valuekey_store— map ofkey_id => {priv_key_bytes, pub_key_bytes}profile— the calling profile module (may be nil)opts— keyword options
Returns {:ok, decoded_term} or {:error, ExIcaoVds.Error.t()}.
@callback encrypt_field( field :: map(), plaintext :: binary(), recipient_config :: map(), profile :: module() | nil, opts :: keyword() ) :: {:ok, binary()} | {:error, ExIcaoVds.Error.t()}
Encrypt the given plaintext bytes for field.
field— field definition map (has:name,:tag,:encoding, etc.)plaintext— the CBOR-encoded field value to encryptrecipient_config— map with recipient public key and key_idprofile— the calling profile module (may be nil)opts— keyword options
Returns {:ok, encrypted_bytes} or {:error, ExIcaoVds.Error.t()}.
Return the encryption mode atom (e.g. :hpke, :none).