Expand description
Version 3 implementation of the encryption protocol
Same algorithms and header authentication as v2, but the content is encrypted as a stream of chunks (bounded memory for any file size) and the header stores an encrypted metadata envelope (filename, mtime, mode). Version 3 of the encryption protocol.
Like v2 it uses XChaCha20-Poly1305 with Argon2id key derivation and authenticates the fixed header fields as associated data, with distinct domain-separation tags. Two things change:
- Streaming content. The content is encrypted as a sequence of AEAD
chunks (see [
stream]) instead of one message, so files of any size can be processed with bounded memory. The per-chunk nonce carries a counter and a final-chunk flag, making reordering, truncation, and extension of the stream fail authentication. - Metadata envelope. The header stores one encrypted envelope (see
[
metadata]) carrying the original filename plus optional mtime and Unix mode, instead of a bare filename ciphertext.
The intended entry points are [stream::StreamSealer::begin] /
[stream::StreamOpener] for streaming, and [file::EncryptedFile] for
whole-bytes use.
This module is deliberately independent of crate::v1 and
crate::v2: the formats share no code, so changes to one can never
silently alter another.
Modules§
- crypt
- Encryption and decryption primitives (AAD-authenticated).
- file
- Encrypted file structures and whole-bytes seal/decrypt operations.
- header
- File header structures, serialization, and header binding for AAD.
- key
- Key derivation parameters and operations.
- metadata
- Plaintext layout of the encrypted metadata envelope. Plaintext layout of the encrypted metadata envelope.
- stream
- Chunked (streaming) content encryption. Chunked (streaming) content encryption for the v3 format.
Constants§
- ALGORITHM
- The AEAD algorithm used by every v3 file.