[][src]Struct pkcs8::PrivateKeyDocument

pub struct PrivateKeyDocument(_);
This is supported on crate feature alloc only.

PKCS#8 private key document

This type provides storage for a PKCS#8 private key encoded as ASN.1 DER with the invariant that the contained-document is "well-formed", i.e. it will parse successfully according to this crate's parsing rules.

Implementations

impl PrivateKeyDocument[src]

pub fn from_der(bytes: &[u8]) -> Result<Self>[src]

Parse PrivateKeyDocument from ASN.1 DER-encoded PKCS#8

pub fn from_pem(s: &str) -> Result<Self>[src]

This is supported on crate feature pem only.

Parse PrivateKeyDocument from PEM-encoded PKCS#8.

PEM-encoded private keys can be identified by the leading delimiter:

-----BEGIN PRIVATE KEY-----

pub fn to_pem(&self) -> Zeroizing<String>[src]

This is supported on crate feature pem only.

Serialize PrivateKeyDocument as self-zeroizing PEM-encoded PKCS#8 string.

pub fn read_der_file(path: impl AsRef<Path>) -> Result<Self>[src]

This is supported on crate feature std only.

Load PrivateKeyDocument from an ASN.1 DER-encoded file on the local filesystem (binary format).

pub fn read_pem_file(path: impl AsRef<Path>) -> Result<Self>[src]

This is supported on crate features pem and std only.

Load PrivateKeyDocument from a PEM-encoded file on the local filesystem.

pub fn write_der_file(&self, path: impl AsRef<Path>) -> Result<()>[src]

This is supported on crate feature std only.

Write ASN.1 DER-encoded PKCS#8 private key to the given path

pub fn write_pem_file(&self, path: impl AsRef<Path>) -> Result<()>[src]

This is supported on crate features pem and std only.

Write PEM-encoded PKCS#8 private key to the given path

pub fn private_key_info(&self) -> PrivateKeyInfo<'_>[src]

Parse the PrivateKeyInfo contained in this PrivateKeyDocument

Trait Implementations

impl AsRef<[u8]> for PrivateKeyDocument[src]

impl Clone for PrivateKeyDocument[src]

impl Debug for PrivateKeyDocument[src]

impl FromStr for PrivateKeyDocument[src]

This is supported on crate feature pem only.

type Err = Error

The associated error which can be returned from parsing.

impl<'_> TryFrom<&'_ [u8]> for PrivateKeyDocument[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Vec<u8, Global>> for PrivateKeyDocument[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.