Skip to content

Every sealed region is encrypted in place and ends with a 32-byte trailer. The regions are a WAL block, a MANIFEST record body, a SEAM frame, a SEAM footer and a derived cache file. TRAILER_LEN is 32.

Offsets are from the start of the trailer.

Offset Size Type Meaning
0 16 bytes GCM tag
16 4 u32 LE nonce[0..4] = epoch
20 8 u64 LE nonce[4..12] = counter
28 4 u32 LE data key id
Seal trailer, 32 bytes
  1. tag16 B
  2. epoch4 B
  3. counter8 B
  4. key id4 B

To open a region, a reader reads the key id and the nonce from the trailer, looks up the key in the keyring, and decrypts region[..len-32] with the tag.

The whole plaintext of the region plus the AAD. The trailer’s nonce and key id are not in the AAD but are bound by the GCM tag: a wrong nonce or key fails authentication.