Struct Certificate
pub struct Certificate { /* private fields */ }
Represents a server X509 certificate.
Implementations
impl Certificate
fn from_der(der: &[u8]) -> Result<Certificate>Create a
Certificatefrom a binary DER encoded certificateExamples
# 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
Certificatefrom a PEM encoded certificateExamples
# 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,.ceror.pemfiles.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