pub fn from_pem(pem: &[u8]) -> crate::Result<Certificate> {
        Ok(Certificate {
            #[cfg(feature = "native-tls-crate")]
            native: native_tls_crate::Certificate::from_pem(pem).map_err(crate::error::builder)?,
            #[cfg(feature = "rustls-tls")]
            original: Cert::Pem(pem.to_owned()),
        })
    }
/// Create a `Certificate` from a PEM encoded certificate
///
/// # Examples
///
/// ```
/// # use std::fs::File;
/// # use std::io::Read;
/// # fn cert() -> Result<(), Box<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(())
/// # }
/// ```
Create a `Certificate` from a PEM encoded certificate
Create a ` Certificate ` from a PEM encoded certificate
pub fn from_pem(pem: &[u8]) -> crate::Result<Certificate> {
        Ok(Certificate {
            #[cfg(feature = "native-tls-crate")]
            native: native_tls_crate::Certificate::from_pem(pem).map_err(crate::error::builder)?,
            #[cfg(feature = "rustls-tls")]
            original: Cert::Pem(pem.to_owned()),
        })
    }
pub fn from_pem ( pem : & [ u8 ] ) -> crate :: Result < Certificate > { Ok ( Certificate { # [ cfg ( feature " " ) ] native : native_tls_crate :: Certificate :: from_pem ( pem ) . map_err ( crate :: error :: builder ) ? , # [ cfg ( feature " " ) ] original : Cert :: Pem ( pem . to_owned ( ) ) , } ) }
Create a `Certificate` from a PEM encoded certificate
Create a ` Certificate ` from a PEM encoded certificate
pem
&[u8]
pem
&[u8]
examples
None
use std::fs::file;
None
use std::io::read;
None
fn cert() -> result<(), box<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)?.
let mut buf = Vec :: new () ; File :: open ( " my_cert . pem " ) . . read_to_end ( &mut buf ) ? ; let cert = reqwest :: Certificate :: from_pem ( &buf ) ? .
drop(cert);
None
ok(())
None
}
None