Skip to main content

PathBuilder

Struct PathBuilder 

Source
pub struct PathBuilder<'a, 'p> { /* private fields */ }
Expand description

Build a VerifiedPath for an end-entity certificate from the given trust anchors.

Implementations§

Source§

impl<'a, 'p: 'a> PathBuilder<'a, 'p>

Source

pub fn new( intermediate_certs: &'p [CertificateDer<'p>], revocation: Option<RevocationOptions<'a>>, eku: &'p dyn ExtendedKeyUsageValidator, supported_sig_algs: &'a [&'a dyn SignatureVerificationAlgorithm], trust_anchors: &'p [TrustAnchor<'p>], ) -> Self

Build a new PathBuilder with the given parameters.

  • intermediate_certs is the list of intermediate certificates to use for path building. These certificates should be sent by the peer. They are not trusted, but can be used to build a path to a trusted root.
  • revocation provides the revocation options to use for path building. If None, no revocation checks will be performed.
  • eku is the intended usage of the certificate, indicating what kind of usage we’re verifying the certificate for. The default ExtendedKeyUsageValidator implementation is ExtendedKeyUsage.
  • supported_sig_algs is the list of signature algorithms that are trusted for use in certificate signatures; the end-entity certificate’s public key is not validated against this list.
  • trust_anchors is the list of root CAs to trust in the built path.
Source

pub fn with_path_verification( self, verify: &'a dyn Fn(&VerifiedPath<'_>) -> Result<(), Error>, ) -> Self

Set a path verification function to use for path building.

verify() will only be called for potentially verified paths, that is, paths that have been verified up to the trust anchor. As such, verify() cannot be used to verify a path that doesn’t satisfy the constraints listed above; it can only be used to reject a path that does satisfy the aforementioned constraints. If verify() returns an error, path building will continue in order to try other options.

By default, no additional path verification is done.

Source

pub fn build( &self, end_entity: &'p EndEntityCert<'p>, time: UnixTime, ) -> Result<VerifiedPath<'p>, Error>

Build a VerifiedPath for end_entity at the given time.

If successful, yields a VerifiedPath type that can be used to inspect a verified chain of certificates that leads from the end_entity to one of the self.trust_anchors.

Auto Trait Implementations§

§

impl<'a, 'p> !RefUnwindSafe for PathBuilder<'a, 'p>

§

impl<'a, 'p> !Send for PathBuilder<'a, 'p>

§

impl<'a, 'p> !Sync for PathBuilder<'a, 'p>

§

impl<'a, 'p> !UnwindSafe for PathBuilder<'a, 'p>

§

impl<'a, 'p> Freeze for PathBuilder<'a, 'p>

§

impl<'a, 'p> Unpin for PathBuilder<'a, 'p>

§

impl<'a, 'p> UnsafeUnpin for PathBuilder<'a, 'p>

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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.