Expand description
Version 2 implementation of the encryption protocol
Same algorithms as v1, but authenticates the header via associated data with domain separation between filename and content encryption. Version 2 of the encryption protocol.
Like v1 it uses XChaCha20-Poly1305 with Argon2id key derivation and an identical header layout (with version byte 2). The difference is that v2 authenticates the header: every AEAD operation binds the fixed header fields (magic, version, salt, KDF parameters, both nonces) as associated data, with distinct domain-separation tags for the filename and the content. This prevents an attacker from swapping the filename and content ciphertexts within a file or tampering with header fields without detection.
This format is legacy: new files are always written as v3, and v2
support exists to decrypt and list existing files. The intended entry
points are [file::EncryptedFile::seal] (kept for round-trip tests) and
[file::EncryptedFile::decrypt], which own the AEAD choreography
(nonce/ciphertext pairing, domain separation, header binding); the
submodules expose the underlying pieces.
This module is deliberately independent of crate::v1: the two formats
share no code, so changes to one can never silently alter the other.
Modules§
- crypt
- Encryption and decryption primitives (AAD-authenticated).
- file
- Encrypted file structures and whole-file seal/decrypt operations.
- header
- File header structures, serialization, and header binding for AAD.
- key
- Key derivation parameters and operations.
Constants§
- ALGORITHM
- The AEAD algorithm used by every v2 file.