Struct Identity

struct Identity { ... }

Represents a private key and X509 cert as a client certificate.

Implementations

impl Identity

fn from_pem(buf: &[u8]) -> crate::Result<Identity>

Parses PEM encoded private key and certificate.

The input should contain a PEM encoded private key and at least one PEM encoded certificate.

Note: The private key must be in RSA, SEC1 Elliptic Curve or PKCS#8 format.

Examples

# use std::fs::File;
# use std::io::Read;
# fn pem() -> Result<(), Box<dyn std::error::Error>> {
let mut buf = Vec::new();
File::open("my-ident.pem")?
    .read_to_end(&mut buf)?;
let id = reqwest::Identity::from_pem(&buf)?;
# drop(id);
# Ok(())
# }

Optional

This requires the rustls(-...) Cargo feature enabled.

impl Clone for Identity

fn clone(self: &Self) -> Identity

impl Debug for Identity

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

impl Freeze for Identity

impl RefUnwindSafe for Identity

impl Send for Identity

impl Sync for Identity

impl Unpin for Identity

impl UnwindSafe for Identity

impl<T> Any for Identity

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Identity

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

impl<T> BorrowMut for Identity

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

impl<T> CloneToUninit for Identity

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

impl<T> ErasedDestructor for Identity

impl<T> From for Identity

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for Identity

impl<T> PolicyExt for Identity

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 Identity

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

impl<T> WithSubscriber for Identity

impl<T, U> Into for Identity

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 Identity

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

impl<T, U> TryInto for Identity

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