sigstore-verify
Sigstore signature verification for sigstore-rust.
Overview
This crate provides high-level APIs for verifying Sigstore signatures. It handles the complete verification flow: bundle parsing, certificate chain validation, signature verification, transparency log verification, and identity policy enforcement.
Features
- Bundle verification: Verify standard Sigstore bundles
- Certificate validation: X.509 chain validation against Fulcio CA
- Transparency log verification: Checkpoint signatures, inclusion proofs, SETs
- Timestamp verification: RFC 3161 timestamp validation
- Identity policies: Verify signer identity claims (issuer, subject, etc.)
Verification Steps
The policy you pass decides the kind of bundle accepted: a VerificationPolicy
for keyless bundles (signed with a Fulcio certificate), or a
PublicKeyVerificationPolicy for managed-key bundles (signed with a key you
supply). A bundle of the other kind is rejected.
- Parse and validate bundle structure
- Verify timestamps: RFC 3161 timestamps and, for Rekor v1 entries, the log's integrated time
- Keyless only: verify the certificate chain against the trusted root at every verified time, the certificate's SCT, and the identity and issuer the policy requires
- Verify the transparency log entry (checkpoint, inclusion proof, or SET)
- Verify the signature over the artifact, with the certificate's key or the policy's key
- Check that the log entry describes this bundle and artifact
Offline verification and Cargo features
The default sigstore-verify dependency tree (default = ["rustls", "aws-lc-rs"])
has no HTTP client or Tokio runtime: rustls only configures sigstore-trust-root
when tuf is also enabled. Verification always uses the supplied trusted root and
never fetches artifacts or keys.
- Default (
aws-lc-rs): Usesaws-lc-rsfor cryptographic verification. Enabletuf(plus defaultrustlsornative-tls) when the application also needs network trust-root refreshes. - Custom
CryptoProvider(default-features = false): Omitsaws-lc-rsso you can install a customsigstore_crypto::CryptoProviderviasigstore_crypto::install_default_provider(...)(seecrates/sigstore-crypto/tests/boring_provider.rsfor a BoringSSL reference implementation). When combining a custom provider withtuf, userustls-no-provider(and install a matchingrustls::crypto::CryptoProviderat startup) ornative-tlssorustlsdoes not pull inaws-lc-sys.
Verifier construction
Verifier::new(&root)? prepares Rekor/CT keyrings and Fulcio trust anchors before
reading artifacts. Invalid certificates, keys, duplicate log IDs and reversed
validity windows are errors at construction. Unsupported configured keys must be
removed explicitly rather than silently ignored. Key/authority activation times
are still checked when verifying, so long-lived verifiers do not freeze time.
Verification results
VerificationResult is created only by successful verification and exposes
read-only accessors. identity() and issuer() are certificate claims;
certificate_verified(), sct_verified(), tlog_verified() and
identity_policy_checked() describe what was actually checked.
verified_timestamps() excludes unsigned time hints. Relaxed policies must not
be treated as equivalent to full certificate and log verification.
Authorization
VerificationPolicy has no default. Prefer VerificationPolicy::new(identity, issuer)
to authorize the expected signer. any_identity() is an explicit opt-in to
cryptographic verification without signer authorization. The example CLI likewise
requires an identity/issuer restriction or --allow-any-identity.
Usage
use ;
use ;
use ;
let bundle: Bundle = from_str?;
let policy = any_identity;
// Actively choose the Sigstore instance and fetch its root through TUF.
let root = from_tuf.await?;
// Verify with raw artifact bytes
let artifact_bytes = b"hello world";
let result = verify?;
// Or verify with pre-computed SHA-256 digest (useful for large files)
let digest = from_hex?;
let result = verify?;
// Or use a Verifier directly; it also offers the same inputs
let verifier = new?;
let result = verifier.verify?;
// Stream a large artifact in constant memory
let file = open?;
let result = verifier.verify_reader?;
// Runtime-independent futures_io::AsyncRead is also supported
let result = verifier.verify_async_reader.await?;
// Managed-key bundles use the same entry points; the key is part of the policy
let key_policy = new;
let result = verifier.verify?;
For Tokio readers, enable tokio-util's compat feature and use
tokio_util::compat::TokioAsyncReadCompatExt::compat() on the file or stream.
Reader verification rejects message-signature schemes that require the original
bytes (such as Ed25519) before consuming input; use the byte API for those schemes.
For GitHub artifact attestations, choose GitHub's Sigstore instance explicitly and use the GitHub verification profile:
use ;
use ;
use ;
let bundle: Bundle = from_str?;
let artifact_digest = from_hex?;
// Fetch GitHub's trusted root over TUF (now supported via the `sigstore-tuf`
// client), or use the embedded copy below for an offline path.
// let root = TrustedRoot::from_tuf(sigstore_trust_root::TufConfig::github()).await?;
let root = from_embedded?;
let policy = any_identity.skip_tlog_unsafe.skip_sct;
let result = verify?;
Verification Policies
use VerificationPolicy;
// Default policy (verify tlog, timestamps, and certificate chain)
let policy = any_identity;
// Require specific identity and issuer
let policy = any_identity
.require_identity
.require_issuer;
// Skip certain verifications (for testing only)
let policy = any_identity
.skip_tlog_unsafe
.skip_certificate_chain;
Managed-key bundles carry no certificate, so the key goes in the policy:
use DerPublicKey;
use PublicKeyVerificationPolicy;
let public_key = from_pem?;
// Verify the signature, timestamps and transparency log entry
let policy = new;
// Skip transparency log inclusion (for testing only)
let policy = policy.skip_tlog_unsafe;
All verify functions accept either policy. When the kind of policy is chosen at
runtime, pass a &dyn Policy:
use ;
let policy: = match public_key ;
let result = verify?;
Related Crates
sigstore-sign- Create signatures to verify with this crate
License
Apache-2.0