pub struct Certificate { /* private fields */ }
Expand description
Represents a server X509 certificate.
Implementations§
Source§impl Certificate
impl Certificate
Sourcepub fn from_der(der: &[u8]) -> Result<Certificate>
pub fn from_der(der: &[u8]) -> Result<Certificate>
Create a Certificate
from a binary DER encoded certificate
§Examples
let mut buf = Vec::new();
File::open("my_cert.der")?
.read_to_end(&mut buf)?;
let cert = reqwest::Certificate::from_der(&buf)?;
Sourcepub fn from_pem(pem: &[u8]) -> Result<Certificate>
pub fn from_pem(pem: &[u8]) -> Result<Certificate>
Create a Certificate
from a PEM encoded certificate
§Examples
let mut buf = Vec::new();
File::open("my_cert.pem")?
.read_to_end(&mut buf)?;
let cert = reqwest::Certificate::from_pem(&buf)?;
Sourcepub fn from_pem_bundle(pem_bundle: &[u8]) -> Result<Vec<Certificate>>
pub fn from_pem_bundle(pem_bundle: &[u8]) -> Result<Vec<Certificate>>
Create a collection of Certificate
s from a PEM encoded certificate bundle.
Example byte sources may be .crt
, .cer
or .pem
files.
§Examples
let mut buf = Vec::new();
File::open("ca-bundle.crt")?
.read_to_end(&mut buf)?;
let certs = reqwest::Certificate::from_pem_bundle(&buf)?;
Trait Implementations§
Source§impl Clone for Certificate
impl Clone for Certificate
Source§fn clone(&self) -> Certificate
fn clone(&self) -> Certificate
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for Certificate
impl RefUnwindSafe for Certificate
impl Send for Certificate
impl Sync for Certificate
impl Unpin for Certificate
impl UnwindSafe for Certificate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more