Skip to main content

Module verification

Module verification 

Source
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 needed

Structs§

ParsedHeader
Helper struct for complete header information

Functions§

add_encryption_metadata
Add encryption metadata to a section’s header field
add_file_hashDeprecated
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