pub struct PrivateKey<'a> { /* private fields */ }
Expand description
A private key used in client certificate auth.
The internal representation is DER form. The provided helpers for PEM translates to DER.
Deliberately not Clone
to avoid accidental copies in memory.
Implementations§
Source§impl<'a> PrivateKey<'a>
impl<'a> PrivateKey<'a>
Sourcepub fn from_der(kind: KeyKind, der: &'a [u8]) -> Self
pub fn from_der(kind: KeyKind, der: &'a [u8]) -> Self
Read private key in DER form.
Does not immediately validate whether the data provided is a valid DER. That validation is the responsibility of the TLS provider.
Sourcepub fn from_pem(pem: &'a [u8]) -> Result<PrivateKey<'static>, Error>
pub fn from_pem(pem: &'a [u8]) -> Result<PrivateKey<'static>, Error>
Read a private key in PEM form.
This is a shorthand for parse_pem
followed by picking the first found key.
Fails with an error if there are no keys found in the PEM given.
Translates to DER format internally.
Sourcepub fn to_owned(&self) -> PrivateKey<'static>
pub fn to_owned(&self) -> PrivateKey<'static>
Clones (allocates) to produce a static copy.
Trait Implementations§
Source§impl<'a> AsRef<[u8]> for PrivateKey<'a>
impl<'a> AsRef<[u8]> for PrivateKey<'a>
Source§impl<'a> Debug for PrivateKey<'a>
impl<'a> Debug for PrivateKey<'a>
Source§impl<'a> From<PrivateKey<'a>> for PemItem<'a>
impl<'a> From<PrivateKey<'a>> for PemItem<'a>
Source§fn from(value: PrivateKey<'a>) -> Self
fn from(value: PrivateKey<'a>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'a> Freeze for PrivateKey<'a>
impl<'a> RefUnwindSafe for PrivateKey<'a>
impl<'a> Send for PrivateKey<'a>
impl<'a> Sync for PrivateKey<'a>
impl<'a> Unpin for PrivateKey<'a>
impl<'a> UnwindSafe for PrivateKey<'a>
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