Expand description
Plaintext layout of the encrypted metadata envelope. Plaintext layout of the encrypted metadata envelope.
The envelope is serialized, then AEAD-encrypted under the metadata domain and stored in the header. Layout (little endian):
| field | size | present |
|---|---|---|
| flags | 1 byte | always |
| filename_len | 2 bytes | always |
| filename | variable | always (UTF-8) |
| mtime_secs | 8 bytes | flags bit 0 (signed) |
| mtime_nanos | 4 bytes | flags bit 0 |
| mode | 4 bytes | flags bit 1 |
Flags bit 2 marks the content as a crate::archive stream (a
directory tree) instead of a single file’s bytes; filename is then the
directory name.
Trailing unknown bytes are rejected: this layout is fixed for the v3 format, and any extension is a new format version.
Functions§
- parse
- Parses a decrypted metadata envelope. Any structural mismatch (bad
lengths, unknown flags, trailing bytes, invalid UTF-8 filename) is
FileError::InvalidMetadata. - serialize
- Serializes a metadata envelope. Fails with
HeaderError::MetadataTooLongwhen the filename pushes the envelope past what the header can hold.