SaltDns. Shaker. Age
(Salt v1.0.0)
Encryption in the age v1 file format, for envelopes sent to a Shaker. Pure;
only :crypto is used.
Salt is the sender only. A Shaker makes an X25519 key pair at first run and
enrols its public half (the "recipient", written age1...); every payload
Salt sends is encrypted to that recipient here. The contract leaves both
halves of this to Salt on purpose (docs/suite/plans/salt-certificates-build.md,
decision 4): calling the reference age program cannot pass secrets cleanly
on standard input, and the one Elixir package is old.
The format is the one at https://c2sp.org/age (age-encryption.org/v1):
- a textual header with one X25519 stanza per recipient, each wrapping the 16-byte file key, ending in an HMAC-SHA-256 of the header;
- a binary payload: a 16-byte nonce, then 64 KiB chunks of ChaCha20-Poly1305, each with an 11-byte big-endian counter and a final flag in the last nonce byte (the STREAM construction).
Base64 in the header is standard base64 without padding, wrapped at 64
columns. Coreutils-style age and its Rust library read what this writes;
test/salt_dns/shaker/age_test.exs (tag :age_cli) proves it against the
reference tool for every chunk boundary and for more than one recipient.
The private half of a Shaker's key never exists here. Decryption is only in
test support (SaltDns.Shaker.TestAge), kept deliberately independent so
the round-trip test does not prove a module against itself.
Summary
Functions
The largest plaintext chunk age encrypts before the next chunk starts.
Decodes an age1... recipient into its 32-byte X25519 public key.
Encodes a 32-byte X25519 public key as an age1... recipient.
Encrypts plaintext to one or more recipients.
Types
Functions
@spec chunk_bytes() :: pos_integer()
The largest plaintext chunk age encrypts before the next chunk starts.
Decodes an age1... recipient into its 32-byte X25519 public key.
Anything malformed is refused: a missing or wrong human-readable part, mixed case, characters outside the Bech32 alphabet, a bad checksum, non-canonical padding bits, and any length other than 32 bytes.
Encodes a 32-byte X25519 public key as an age1... recipient.
Encrypts plaintext to one or more recipients.
Each recipient is either a 32-byte X25519 public key or its age1... Bech32
form. Returns the complete age file (header and payload) as one binary.