Struct Identity

pub struct Identity { /* private fields */ }

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

Implementations

impl Identity

fn from_pem(buf: &[u8]) -> 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.

Trait Implementations

impl Clone for Identity

fn clone(&self) -> Identity

impl Debug for Identity

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

Auto Trait Implementations

impl Freeze for Identity

impl RefUnwindSafe for Identity

impl Send for Identity

impl Sync for Identity

impl Unpin for Identity

impl UnsafeUnpin for Identity

impl UnwindSafe for Identity

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for Identity

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for Identity

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

fn and<P, B, E>(self, other: P) -> And<T, P>
where
    T: Sized + Policy<B, E>,
    P: Policy<B, E>,
fn or<P, B, E>(self, other: P) -> Or<T, P>
where
    T: Sized + Policy<B, E>,
    P: Policy<B, E>,

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

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T> WithSubscriber for Identity

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

fn into(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<U> for Identity where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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