Skip to main content

Verifier

Struct Verifier 

Source
pub struct Verifier { /* private fields */ }
Expand description

A verifier for Sigstore signatures

Implementations§

Source§

impl Verifier

Source

pub fn new(trusted_root: &TrustedRoot) -> Self

Create a new verifier with a trusted root

The trusted root is required and contains all cryptographic material needed for verification (Fulcio CA certs, Rekor keys, TSA certs, etc.)

Source

pub fn verify<'a>( &self, artifact: impl Into<Artifact<'a>>, bundle: &Bundle, policy: &VerificationPolicy, ) -> Result<VerificationResult>

Verify an artifact against a bundle

The artifact can be provided as raw bytes or as a pre-computed SHA-256 digest. When using a pre-computed digest, the raw bytes are not needed, which is useful for large files or when the digest is already known (e.g., from a registry).

§Example
use sigstore_verify::{Verifier, VerificationPolicy};
use sigstore_trust_root::TrustedRoot;
use sigstore_types::{Artifact, Bundle, Sha256Hash};

let trusted_root = TrustedRoot::production()?;
let verifier = Verifier::new(&trusted_root);
let bundle: Bundle = todo!();
let policy = VerificationPolicy::default();

// Option 1: Verify with raw bytes
let artifact_bytes = b"hello world";
verifier.verify(artifact_bytes.as_slice(), &bundle, &policy)?;

// Option 2: Verify with pre-computed digest (no raw bytes needed!)
let digest = Sha256Hash::from_hex("b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9")?;
verifier.verify(digest, &bundle, &policy)?;

In order to verify an artifact, we need to achieve the following:

  1. Establish a time for the signature.
  2. Verify that the signing certificate chains to the root of trust and is valid at the time of signing.
  3. Verify the signing certificate’s SCT.
  4. Verify that the signing certificate conforms to the Sigstore X.509 profile as well as the passed-in VerificationPolicy.
  5. Verify the inclusion proof and signed checkpoint for the log entry.
  6. Verify the inclusion promise for the log entry, if present.
  7. Verify the timely insertion of the log entry against the validity period for the signing certificate.
  8. Verify the signature and input against the signing certificate’s public key.
  9. Verify the transparency log entry’s consistency against the other materials, to prevent variants of CVE-2022-36056.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more