Struct Certificate

struct Certificate { ... }

Represents a server X509 certificate.

Implementations

impl Certificate

fn from_der(der: &[u8]) -> crate::Result<Certificate>

Create a Certificate from a binary DER encoded certificate

Examples

# use std::fs::File;
# use std::io::Read;
# fn cert() -> Result<(), Box<dyn std::error::Error>> {
let mut buf = Vec::new();
File::open("my_cert.der")?
    .read_to_end(&mut buf)?;
let cert = reqwest::Certificate::from_der(&buf)?;
# drop(cert);
# Ok(())
# }
fn from_pem(pem: &[u8]) -> crate::Result<Certificate>

Create a Certificate from a PEM encoded certificate

Examples

# use std::fs::File;
# use std::io::Read;
# fn cert() -> Result<(), Box<dyn std::error::Error>> {
let mut buf = Vec::new();
File::open("my_cert.pem")?
    .read_to_end(&mut buf)?;
let cert = reqwest::Certificate::from_pem(&buf)?;
# drop(cert);
# Ok(())
# }
fn from_pem_bundle(pem_bundle: &[u8]) -> crate::Result<Vec<Certificate>>

Create a collection of Certificates from a PEM encoded certificate bundle. Example byte sources may be .crt, .cer or .pem files.

Examples

# use std::fs::File;
# use std::io::Read;
# fn cert() -> Result<(), Box<dyn std::error::Error>> {
let mut buf = Vec::new();
File::open("ca-bundle.crt")?
    .read_to_end(&mut buf)?;
let certs = reqwest::Certificate::from_pem_bundle(&buf)?;
# drop(certs);
# Ok(())
# }

impl Clone for Certificate

fn clone(self: &Self) -> Certificate

impl Debug for Certificate

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

impl Freeze for Certificate

impl RefUnwindSafe for Certificate

impl Send for Certificate

impl Sync for Certificate

impl Unpin for Certificate

impl UnwindSafe for Certificate

impl<T> Any for Certificate

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Certificate

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Certificate

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

impl<T> CloneToUninit for Certificate

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> ErasedDestructor for Certificate

impl<T> From for Certificate

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for Certificate

impl<T> PolicyExt for Certificate

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

impl<T> ToOwned for Certificate

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> WithSubscriber for Certificate

impl<T, U> Into for Certificate

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for Certificate

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

impl<T, U> TryInto for Certificate

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