pub fn read_file_version<R>(reader: &mut R) -> Result<(u8, u8), AescryptError>where
R: Read,Expand description
Reads and validates the 5-byte AES Crypt file header.
Returns (version, modulo_or_reserved) where:
versionis the file format version (0..=3).modulo_or_reservedis the 5th header byte:- For v0: the modulo byte (any value; passed to
StreamConfig::V0for final plaintext-length recovery). - For v1–v3: the reserved byte; an error is returned unless it is
0x00.
- For v0: the modulo byte (any value; passed to
This is the strict counterpart to crate::read_version, which only
reads as many bytes as needed and is permissive about short v0 stubs.
§Errors
AescryptError::Io— premature EOF or other reader error.AescryptError::Header— magic bytes are notb"AES", or the v1–v3 reserved byte is not0x00.AescryptError::UnsupportedVersion— version byte is> 3.
§Security
Reads exactly 5 bytes regardless of input, capping pre-authentication
effort. The output is plain (u8, u8) — there is nothing secret to
zeroize.