minisign-verify
A small, zero-dependencies Rust crate to verify Minisign signatures.
Features
- Verify signatures for both standard and pre-hashed modes
- Streaming verification for large files
- No external dependencies
- Simple, auditable code
- Comprehensive error reporting
Basic Example
let public_key =
from_base64
.expect;
let signature = decode.expect;
let bin = b"test";
public_key.verify.expect;
Loading from Files
use ;
use Path;
// Load a public key from a file
let public_key = from_file
.expect;
// Load a signature from a file
let signature = from_file
.expect;
// Load the file content to verify
let content = read.expect;
// Verify the signature
public_key
.verify
.expect;
Streaming Verification (for Large Files)
use ;
use File;
use Read;
use Path;
// Load a public key and signature
let public_key = from_file
.expect;
let signature = from_file
.expect;
// Create a stream verifier
let mut verifier = public_key.verify_stream
.expect;
// Process the file in chunks
let mut file = open.expect;
let mut buffer = ; // 8KB buffer
loop
// Verify the signature
verifier.finalize.expect;
Note that the streaming verification mode only works with pre-hashed signatures (the default in newer versions of Minisign).
Running Benchmarks
To run the benchmarks:
License
MIT