Skip to main content

Module verify

Module verify 

Source
Expand description

Cryptographic verification: minisign signatures and SHA-256 checksums.

§Signature format

One format is supported: minisign’s prehashed ED variant, ed25519(BLAKE2b-512(<file>)). Legacy pure Ed and bare 64-byte signatures are not accepted.

That is deliberate, and it is what lets one published file serve both consumers of a release. cargo-binstall requires the prehashed variant and rejects legacy outright, so accepting only ED means what rtb-update trusts is exactly what cargo-binstall trusts. The prehash is also what allows an HSM-held signing key to sign an artefact of any size — the signer only ever sees a 64-byte digest, well inside the AWS KMS 4096-byte message cap.

§Verification is delegated, not reimplemented

Parsing and checking are done by minisign_verify — the same crate cargo-binstall uses — rather than by hand. Two independent implementations of one check is how the two consumers would silently drift apart; sharing the implementation makes that impossible. The crate is zero-dependency (it vendors its own BLAKE2b), so this costs nothing in tree weight.

It verifies more than the artefact signature: the algorithm tag, the key id, the signature itself, and the global signature over signature ‖ trusted_comment. The trusted comment therefore cannot be altered without detection — which matters, because producers record the signing project in it.

§Public key policy

ToolMetadata::update_public_keys holds minisign public keys as base64 strings — the same value pinned as pubkey in a crate’s [package.metadata.binstall.signing] table. Any one verifying is accepted, so a binary shipped trusting {old, new} spans a key rotation without a dual-signing window.

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.
minisign
Verify asset_bytes against the minisign signature sig_bytes under any key in trusted_keys. Returns Ok as soon as one key verifies.
sha256_hex
Compute the SHA-256 of bytes, lower-case hex-encoded.