Struct CertData

Source
pub struct CertData { /* private fields */ }

Implementations§

Source§

impl CertData

Source

pub fn from_iter<E, I>(iter: I) -> Result<Self, E>
where I: IntoIterator<Item = Result<Object, E>>,

Examples found in repository?
examples/print_stuff.rs (line 16)
13fn main() {
14    for path in args().skip(1) {
15        let objs = ObjectIter::new(BufReader::new(File::open(path).unwrap()));
16        let stuff = CertData::from_iter(objs).unwrap();
17        println!("pub const ALL_CERTS: &'static [Certificate<'static>] = &{:#?};",
18                 stuff.certs());
19        println!("pub const TLS_SERVER_TRUST_ROOTS: &'static [Certificate<'static>] = &{:#?};",
20                 stuff.trusted_certs(Usage::TlsServer));
21        println!("pub const TLS_SERVER_DISTRUSTS: &'static [Trust<'static>] = &{:#?};",
22                 stuff.distrusts(Usage::TlsServer));
23    }
24}
Source

pub fn certs(&self) -> &[Certificate]

Examples found in repository?
examples/print_stuff.rs (line 18)
13fn main() {
14    for path in args().skip(1) {
15        let objs = ObjectIter::new(BufReader::new(File::open(path).unwrap()));
16        let stuff = CertData::from_iter(objs).unwrap();
17        println!("pub const ALL_CERTS: &'static [Certificate<'static>] = &{:#?};",
18                 stuff.certs());
19        println!("pub const TLS_SERVER_TRUST_ROOTS: &'static [Certificate<'static>] = &{:#?};",
20                 stuff.trusted_certs(Usage::TlsServer));
21        println!("pub const TLS_SERVER_DISTRUSTS: &'static [Trust<'static>] = &{:#?};",
22                 stuff.distrusts(Usage::TlsServer));
23    }
24}
Source

pub fn trusts(&self) -> &[Trust]

Source

pub fn trust_for(&self, issuer: &[u8], serial: &[u8]) -> Option<&Trust>

Source

pub fn trust_for_cert(&self, cert: &Certificate) -> Option<&Trust>

Source

pub fn trusted_certs(&self, usage: Usage) -> Vec<&Certificate>

Examples found in repository?
examples/print_stuff.rs (line 20)
13fn main() {
14    for path in args().skip(1) {
15        let objs = ObjectIter::new(BufReader::new(File::open(path).unwrap()));
16        let stuff = CertData::from_iter(objs).unwrap();
17        println!("pub const ALL_CERTS: &'static [Certificate<'static>] = &{:#?};",
18                 stuff.certs());
19        println!("pub const TLS_SERVER_TRUST_ROOTS: &'static [Certificate<'static>] = &{:#?};",
20                 stuff.trusted_certs(Usage::TlsServer));
21        println!("pub const TLS_SERVER_DISTRUSTS: &'static [Trust<'static>] = &{:#?};",
22                 stuff.distrusts(Usage::TlsServer));
23    }
24}
Source

pub fn distrusts(&self, usage: Usage) -> Vec<&Trust>

Examples found in repository?
examples/print_stuff.rs (line 22)
13fn main() {
14    for path in args().skip(1) {
15        let objs = ObjectIter::new(BufReader::new(File::open(path).unwrap()));
16        let stuff = CertData::from_iter(objs).unwrap();
17        println!("pub const ALL_CERTS: &'static [Certificate<'static>] = &{:#?};",
18                 stuff.certs());
19        println!("pub const TLS_SERVER_TRUST_ROOTS: &'static [Certificate<'static>] = &{:#?};",
20                 stuff.trusted_certs(Usage::TlsServer));
21        println!("pub const TLS_SERVER_DISTRUSTS: &'static [Trust<'static>] = &{:#?};",
22                 stuff.distrusts(Usage::TlsServer));
23    }
24}

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.