Struct PrivatePkcs8KeyDer

pub struct PrivatePkcs8KeyDer<'a>(/* private field */);

A DER-encoded plaintext private key; as specified in PKCS#8/RFC 5958

PKCS#8 private keys are identified in PEM context as PRIVATE KEY and when stored in a file usually use a .pem or .key extension. For more on PEM files, refer to the crate documentation.

# #[cfg(all(feature = "alloc", feature = "std"))] {
use rustls_pki_types::{PrivatePkcs8KeyDer, pem::PemObject};

// load from a PEM file
PrivatePkcs8KeyDer::from_pem_file("tests/data/nistp256key.pkcs8.pem").unwrap();
PrivatePkcs8KeyDer::from_pem_file("tests/data/rsa1024.pkcs8.pem").unwrap();

// or from a PEM byte slice...
# let byte_slice = include_bytes!("../tests/data/nistp256key.pkcs8.pem");
PrivatePkcs8KeyDer::from_pem_slice(byte_slice).unwrap();
# }

Implementations

impl PrivatePkcs8KeyDer<'_>

fn clone_key(&self) -> PrivatePkcs8KeyDer<'static>

Clone the private key to a 'static value

fn secret_pkcs8_der(&self) -> &[u8]

Yield the DER-encoded bytes of the private key

Trait Implementations

impl Debug for PrivatePkcs8KeyDer<'_>

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

impl From<Vec<u8>> for PrivatePkcs8KeyDer<'_>

fn from(vec: Vec<u8>) -> Self

impl Zeroize for PrivatePkcs8KeyDer<'static>

fn zeroize(&mut self)

impl<'a> Eq for PrivatePkcs8KeyDer<'a>

impl<'a> From<&'a [u8]> for PrivatePkcs8KeyDer<'a>

fn from(slice: &'a [u8]) -> Self

impl<'a> PartialEq for PrivatePkcs8KeyDer<'a>

fn eq(&self, other: &PrivatePkcs8KeyDer<'a>) -> bool

impl<'a> StructuralPartialEq for PrivatePkcs8KeyDer<'a>

Auto Trait Implementations

impl<'a> Freeze for PrivatePkcs8KeyDer<'a>

impl<'a> RefUnwindSafe for PrivatePkcs8KeyDer<'a>

impl<'a> Send for PrivatePkcs8KeyDer<'a>

impl<'a> Sync for PrivatePkcs8KeyDer<'a>

impl<'a> Unpin for PrivatePkcs8KeyDer<'a>

impl<'a> UnsafeUnpin for PrivatePkcs8KeyDer<'a>

impl<'a> UnwindSafe for PrivatePkcs8KeyDer<'a>

Blanket Implementations

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

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for PrivatePkcs8KeyDer<'a> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for PrivatePkcs8KeyDer<'a> where T: ?Sized,

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

impl<T> From<T> for PrivatePkcs8KeyDer<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> PemObject for PrivatePkcs8KeyDer<'a> where T: PemObjectFilter + From<Vec<u8>>,

fn from_pem(kind: SectionKind, der: Vec<u8>) -> Option<T>

impl<T, U> Into<U> for PrivatePkcs8KeyDer<'a> 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 PrivatePkcs8KeyDer<'a> where U: Into<T>,

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

impl<T, U> TryInto<U> for PrivatePkcs8KeyDer<'a> where U: TryFrom<T>,

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