Skip to main content

Module sealed

Module sealed 

Source
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§

SealedStore
SegmentReader
Read access to one committed segment. Blocks decrypt on first access.
SegmentWriter
Appends and rewrites blocks; nothing is visible to a reopened segment until commit.
StoreOptions

Enums§

KeySource
Where the 256-bit master key lives. There is no password derivation on the open path.
Mode

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 security is compiled in. WARM_ENCRYPTION=off selects plaintext and on demands encryption (an error without security).