Struct Certificate

pub struct Certificate { /* private fields */ }

Represents a server X509 certificate.

Implementations

impl Certificate

fn from_der(der: &[u8]) -> 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]) -> 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]) -> 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(())
# }

Trait Implementations

impl Clone for Certificate

fn clone(&self) -> Self

impl Debug for Certificate

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

Auto Trait Implementations

impl Freeze for Certificate

impl RefUnwindSafe for Certificate

impl Send for Certificate

impl Sync for Certificate

impl Unpin for Certificate

impl UnsafeUnpin for Certificate

impl UnwindSafe for Certificate

Blanket Implementations

impl<T> Any for Certificate where T: 'static + ?Sized,

impl<T> Borrow<T> for Certificate where T: ?Sized,

impl<T> BorrowMut<T> for Certificate where T: ?Sized,

impl<T> CloneToUninit for Certificate where T: Clone,

impl<T> From<T> for Certificate

impl<T> Instrument for Certificate

impl<T> PolicyExt for Certificate where T: ?Sized,

impl<T> ToOwned for Certificate where T: Clone,

impl<T> WithSubscriber for Certificate

impl<T, U> Into<U> for Certificate where U: From<T>,

impl<T, U> TryFrom<U> for Certificate where U: Into<T>,

impl<T, U> TryInto<U> for Certificate where U: TryFrom<T>,