#[non_exhaustive]pub struct Header {
pub codec: CodecId,
pub crypto: CryptoId,
pub orig_len: u64,
pub nonce: Option<[u8; 12]>,
pub tag: Option<[u8; 16]>,
pub payload_offset: usize,
pub aad_len: usize,
}Expand description
The decoded header of one on-binary entry, as returned by
read_header.
#[non_exhaustive]: the on-binary layout is expected to grow (a
content hash, per-entry flags), so fields get added over time. Read the
fields you need; do not build one by hand or match it exhaustively.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.codec: CodecIdThe compression applied to the payload.
crypto: CryptoIdThe AEAD cipher the payload was sealed with, if any.
orig_len: u64Length of the file before compression and encryption, in bytes.
Decoders use it to size the output buffer, so it comes from untrusted bytes and must be treated as a claim rather than a fact: reserve fallibly, and check the decoded length against it.
nonce: Option<[u8; 12]>The AEAD nonce, present exactly when crypto is not
CryptoId::None. Stored in the clear, and unique per entry.
tag: Option<[u8; 16]>The detached AEAD authentication tag, present under the same
condition as nonce.
payload_offset: usizeOffset into the entry at which the payload begins, that is the
length of the header this Header was parsed from.
aad_len: usizeLength of the leading bytes – the tag byte and the length varint –
that a sealed entry’s AEAD tag covers as associated data, so that the
codec, cipher and claimed length cannot be rewritten under a tag that
still verifies. entry[..aad_len] is what to hand the cipher.