Struct webpki::trust_anchor::TrustAnchor

source ·
pub struct TrustAnchor<'a> {
    pub subject: &'a [u8],
    pub spki: &'a [u8],
    pub name_constraints: Option<&'a [u8]>,
}
Expand description

A trust anchor (a.k.a. root CA).

Traditionally, certificate verification libraries have represented trust anchors as full X.509 root certificates. However, those certificates contain a lot more data than is needed for verifying certificates. The TrustAnchor representation allows an application to store just the essential elements of trust anchors. The TrustAnchor::try_from_cert_der function allows converting X.509 certificates to to the minimized TrustAnchor representation, either at runtime or in a build script.

Fields§

§subject: &'a [u8]

The value of the subject field of the trust anchor.

§spki: &'a [u8]

The value of the subjectPublicKeyInfo field of the trust anchor.

§name_constraints: Option<&'a [u8]>

The value of a DER-encoded NameConstraints, containing name constraints to apply to the trust anchor, if any.

Implementations§

source§

impl<'a> TrustAnchor<'a>

source

pub fn try_from_cert_der(cert_der: &'a [u8]) -> Result<Self, Error>

Interprets the given DER-encoded certificate as a TrustAnchor. The certificate is not validated. In particular, there is no check that the certificate is self-signed or even that the certificate has the cA basic constraint.

source

fn from_v1_der(cert_der: Input<'a>) -> Result<Self, Error>

Parses a v1 certificate directly into a TrustAnchor.

Trait Implementations§

source§

impl<'a> Debug for TrustAnchor<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> From<Cert<'a>> for TrustAnchor<'a>

source§

fn from(cert: Cert<'a>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for TrustAnchor<'a>

§

impl<'a> RefUnwindSafe for TrustAnchor<'a>

§

impl<'a> Send for TrustAnchor<'a>

§

impl<'a> Sync for TrustAnchor<'a>

§

impl<'a> Unpin for TrustAnchor<'a>

§

impl<'a> UnwindSafe for TrustAnchor<'a>

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

§

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

§

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.