Expand description
Block AEAD container with per-segment data keys and crypto-erase.
A store is a directory holding keys.tbl (the key table) and, per segment, a data file
seg-<id>-g<gen>.dat (concatenated sealed blocks) and a header seg-<id>-g<gen>.hdr
(block index plus one authentication tag). The header is replaced atomically, so the
data file may carry an uncommitted tail after a crash; that tail is ignored and truncated
when the segment is next opened for writing.
Nonce invariant: under one data key every seal operation (block, rewritten block, header
tag) takes a fresh counter from a per-segment sequence. The key table persists a
high-water mark nonce_hwm; a writer reserves a chunk by raising the mark durably before
it uses any counter in the chunk, and a reopened segment resumes at the mark. A counter
is therefore never reused, including after a crash that lost uncommitted blocks, and a
rewritten block is a new record with a new counter.
Plaintext mode uses the same container with a null cipher whose “tag” is a CRC32. It
detects corruption and offers no authenticity or confidentiality; it is an explicit
opt-out (WARM_ENCRYPTION=off or StoreOptions::mode).
Structs§
- Sealed
Store - Segment
Reader - Read access to one committed segment. Blocks decrypt on first access.
- Segment
Writer - Appends and rewrites blocks; nothing is visible to a reopened segment until
commit. - Store
Options
Enums§
Constants§
- DEFAULT_
BLOCK_ BYTES - FORMAT_
VERSION - INDEX_
ENTRY_ BYTES - Header bytes of one block index entry: offset, length, counter, tag.
- MAX_
BLOCK_ BYTES - TAG_LEN
Functions§
- default_
mode - Mode for new stores: encrypted whenever
securityis compiled in.WARM_ENCRYPTION=offselects plaintext andondemands encryption (an error withoutsecurity).