Struct PrivateSec1KeyDer

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

A Sec1-encoded plaintext private key; as specified in RFC 5915

Sec1 private keys are identified in PEM context as EC 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::{PrivateSec1KeyDer, pem::PemObject};

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

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

Implementations

impl PrivateSec1KeyDer<'_>

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

Clone the private key to a 'static value

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

Yield the DER-encoded bytes of the private key

Trait Implementations

impl Debug for PrivateSec1KeyDer<'_>

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

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

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

impl Zeroize for PrivateSec1KeyDer<'static>

fn zeroize(&mut self)

impl<'a> Eq for PrivateSec1KeyDer<'a>

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

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

impl<'a> PartialEq for PrivateSec1KeyDer<'a>

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

impl<'a> StructuralPartialEq for PrivateSec1KeyDer<'a>

Auto Trait Implementations

impl<'a> Freeze for PrivateSec1KeyDer<'a>

impl<'a> RefUnwindSafe for PrivateSec1KeyDer<'a>

impl<'a> Send for PrivateSec1KeyDer<'a>

impl<'a> Sync for PrivateSec1KeyDer<'a>

impl<'a> Unpin for PrivateSec1KeyDer<'a>

impl<'a> UnsafeUnpin for PrivateSec1KeyDer<'a>

impl<'a> UnwindSafe for PrivateSec1KeyDer<'a>

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

fn from(t: T) -> T

Returns the argument unchanged.

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

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

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

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

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

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