Shipped crypto: AEAD, Argon2 (plus future X25519, Shamir)
- Status: SHIPPED in 0.2.0 (secretstream plus Argon2id plus SHA256); X25519, TLS-E2E, Shamir stay PLAN
- Spec: D-08, D-18, D-19, SPEC.md 6.3, SEC-02, SEC-03
- Sources: elite report sections 3 and 5, SPEC.md 6.3 and 8, v2 research, accepted ADR 0005
What it is
The v2 cipher suite that retired SHA256-XOR for new blobs: secretstream XChaCha20-Poly1305 for data at rest (64KB MESSAGE chunks, FINAL terminator, verify-before-serve pre-pass), Argon2id INTERACTIVE (t=2, m=64MiB) for key derivation from store auth plus per-blob salt, standard SHA256 sidecars. Every v2 blob is tamper-evident, not just unreadable. Still future: X25519 key exchange, TLS 1.3 plus end-to-end envelope, Shamir recovery.
How TOSV does it
Per store: random 16-byte salt, one Argon2id derive (serialized
by mutex, 64MB transient bound), secretstream push to
[0x02][salt][header][chunks], tag hash 0 2. Per fetch:
version dispatch on the tag, one pre-pass verifying AEAD plus tag
hash together, then the 200 stream with exact Content-Length from
ciphertext size math. Fetch keys memoize in a bounded cache (128
LRU, 300s TTL, salt-bound, verification never skipped); v1 blobs
keep reading through the frozen legacy path;
unknown versions fail closed.
What it protects against
Silent bit-flip tampering (any flip fails the pre-pass with an
aead-fail audit line), truncation (missing FINAL fails),
reorder and duplication (sequence-bound tags), salt and header
rewrites (wrong key fails the first pull), and offline guessing
(Argon2id prices each guess at 64MiB plus ~90ms).
Attack realism
This is the suite the realistic funded attacker forces: disk
tamperers, malicious hosts flipping bits, and credential databases
attacked offline. libsodium 1.0.22 ships every primitive audited
and pinned (hash adbdd8f...be3349, static link), which is why
the report pins libsodium instead of hand-rolls. Measured
2026-10-31: NFR-04 p95 153ms at 10MB, store 90ms at 1MB,
2-core from-scratch build 29s, binary 567528 bytes.
Pros
Standard, audited primitives. Tamper evidence per blob with a distinguishing audit marker. Offline guessing priced out by memory-hard KDF. Clean migration: version dispatch plus a committed v1 fixture proving old-blob read.
Cons and how the vault resolves them
- New dependency (libsodium) breaks zero-dep purity. Resolved by accepted ADR 0005: hash-pinned source, static-only build, hash plus size verified at vendor time; purity serves auditability, and libsodium is more audited than any hand-roll.
- Argon2id INTERACTIVE sits below RFC 9106 FIRST (2 GiB). Accepted with measurement: 90ms store plus p95 153ms fetch keep NFR-04 headroom; MODERATE revisit needs budget proof (D-18).
- Dual crypt paths during transition. Resolved by the version field plus Gate tests round-tripping both generations plus adversarial tamper, truncation, and salt cases.
- Length still leaks. Accepted: padding stays a future option; v2 leaks no more than the filesystem already shows.
v1 stopgap that held until then
Layered crypt plus audit of every fetch plus honest SPEC 6.3 scope: theft-proof then, tamper-evident since 0.2.0 for new blobs.