Expand description
VSF verification functions for hashing and signing
This module provides standalone functions for adding cryptographic verification to VSF files after they’ve been built. Two independent strategies are supported:
-
Single hash in header covering entire file
-
Simple integrity check for archives
-
Use
add_file_hash()function -
Hash/signature stored in header field definition
-
Signs only specific sections (e.g., lock image data, allow metadata edits)
-
Use
sign_section()function
§Example
ⓘ
use vsf::builders::RawImageBuilder; use vsf::verification::sign_section;
// Build the VSF let bytes = raw.build()?;
// Add verification as neededStructs§
- Parsed
Header - Helper struct for complete header information
Functions§
- add_
encryption_ metadata - Add encryption metadata to a section’s header field
- add_
file_ hash Deprecated - Legacy function for backward compatibility
- compute_
file_ hash - Compute BLAKE3 rolling hash (hb) of VSF file
- compute_
provenance_ hash - Compute BLAKE3 provenance hash (hp) of VSF file
- fill_
provenance_ hash - Fill the provenance hash (hp) placeholder with computed hash bytes
- fill_
signature - Fill the signature (ge) placeholder with signature bytes
- is_
original - Check if a VSF file is an unmodified original by verifying the provenance hash (hp).
- parse_
full_ header - Parse complete VSF header including all header field crypto metadata Robust, order-independent parser using existing VSF tools
- read_
verified - Read a VSF document with verification that CANNOT be skipped.
- verify_
file_ hash - Verify the rolling hash (hb) in a VSF header.
- write_
file_ hash - Write computed hash into the file hash placeholder
- write_
provenance_ hash - Write computed provenance hash (hp) into the placeholder