Skip to main content

RsaPrivateKeyEncoding

Trait RsaPrivateKeyEncoding 

Source
pub trait RsaPrivateKeyEncoding: Sized {
    // Required methods
    fn from_pkcs1_der(bytes: &[u8]) -> Result<Self>;
    fn to_pkcs1_der(&self) -> Result<SecretDocument>;
    fn from_pkcs8_der(bytes: &[u8]) -> Result<Self>;
    fn to_pkcs8_der(&self) -> Result<SecretDocument>;

    // Provided methods
    fn from_pkcs1_pem(pem: &str) -> Result<Self> { ... }
    fn to_pkcs1_pem(&self, ending: LineEnding) -> Result<Zeroizing<String>> { ... }
    fn from_pkcs8_pem(pem: &str) -> Result<Self> { ... }
    fn to_pkcs8_pem(&self, ending: LineEnding) -> Result<Zeroizing<String>> { ... }
    fn from_pkcs8_encrypted_der(
        bytes: &[u8],
        password: impl AsRef<[u8]>,
    ) -> Result<Self> { ... }
    fn from_pkcs8_encrypted_pem(
        pem: &str,
        password: impl AsRef<[u8]>,
    ) -> Result<Self> { ... }
}
Expand description

PKCS#1 and PKCS#8 codecs without enabling the RSA dependency’s codecs.

Required Methods§

Source

fn from_pkcs1_der(bytes: &[u8]) -> Result<Self>

Decode a two-prime PKCS#1 key and validate it with sad-rsa.

Source

fn to_pkcs1_der(&self) -> Result<SecretDocument>

Encode a borrowed key as PKCS#1 in a zeroizing document.

Source

fn from_pkcs8_der(bytes: &[u8]) -> Result<Self>

Decode a PKCS#8 key with a validated algorithm identifier.

Source

fn to_pkcs8_der(&self) -> Result<SecretDocument>

Encode a borrowed key as PKCS#8 in a zeroizing document.

Provided Methods§

Source

fn from_pkcs1_pem(pem: &str) -> Result<Self>

Decode a correctly labeled PKCS#1 PEM key.

Source

fn to_pkcs1_pem(&self, ending: LineEnding) -> Result<Zeroizing<String>>

Encode a PKCS#1 PEM key with explicit line endings.

Source

fn from_pkcs8_pem(pem: &str) -> Result<Self>

Decode a correctly labeled PKCS#8 PEM key.

Source

fn to_pkcs8_pem(&self, ending: LineEnding) -> Result<Zeroizing<String>>

Encode a PKCS#8 PEM key with explicit line endings.

Source

fn from_pkcs8_encrypted_der( bytes: &[u8], password: impl AsRef<[u8]>, ) -> Result<Self>

Decrypt a protected PKCS#8 container before parsing its key.

Source

fn from_pkcs8_encrypted_pem( pem: &str, password: impl AsRef<[u8]>, ) -> Result<Self>

Decode and decrypt a correctly labeled protected PKCS#8 PEM key.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl RsaPrivateKeyEncoding for RsaPrivateKey

Implementors§