Skip to main content

Module verify

Module verify 

Source
Expand description

Cryptographic verification: Ed25519 detached signatures and SHA-256 checksums.

§Signature formats

Two on-wire formats are supported, distinguished by the signature file’s extension:

  • .sig — 64 raw bytes, the Ed25519 signature itself.
  • .minisig — minisign’s text format. Two base64-encoded lines after the untrusted comment: and trusted comment: headers; the first decodes to the Ed25519 key-id + signature (74 bytes), the second is the per-signature trust comment (not used). Only the “Ed” (pure Ed25519) algorithm is supported — the “ED” (prehashed BLAKE2b) variant is rejected with a clear error.

§Public key policy

ToolMetadata::update_public_keys is a Vec<[u8; 32]> — any one of the keys verifying is accepted. This enables key rotation without breaking already-deployed binaries.

Functions§

checksums
Verify asset_bytes against a checksums-file body. The body is in the sha256sum format — one "<hex> <filename>" per line. Matches by the asset_filename’s basename.
ed25519
Verify asset_bytes against the detached-signature sig_bytes under any key in trusted_keys. Returns Ok iff at least one key verifies; otherwise UpdateError::BadSignature.
sha256_hex
Compute the SHA-256 of bytes, lower-case hex-encoded.