Skip to main content

X509StoreCtx

Struct X509StoreCtx 

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

A chain-verification context (X509_STORE_CTX*).

Create with X509StoreCtx::new, initialise with X509StoreCtx::init, then call X509StoreCtx::verify.

Implementations§

Source§

impl X509StoreCtx

Source

pub fn new() -> Result<Self, ErrorStack>

Allocate a new, uninitialised verification context.

§Errors
Source

pub fn init(&mut self, store: &X509Store, cert: &X509) -> Result<(), ErrorStack>

Initialise the context for verifying cert against store.

Call this before Self::verify.

§Errors
Source

pub fn verify(&mut self) -> Result<bool, ErrorStack>

Verify the certificate chain.

Returns Ok(true) if the chain is valid, Ok(false) if not (call Self::error to retrieve the error code), or Err on a fatal error.

§Errors
Source

pub fn error(&self) -> i32

OpenSSL verification error code after a failed Self::verify.

Returns 0 (X509_V_OK) if no error occurred. See <openssl/x509_vfy.h> for the full list of X509_V_ERR_* constants.

Source

pub fn chain(&self) -> Vec<X509>

Collect the verified chain into a Vec<X509>.

Only meaningful after a successful Self::verify. Returns an empty Vec if the chain is not available.

Trait Implementations§

Source§

impl Drop for X509StoreCtx

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for X509StoreCtx

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, 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 = 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.