Skip to main content

PemEncode

Trait PemEncode 

Source
pub trait PemEncode: Sealed + Encode {
    // Required methods
    fn as_pkcs1_pem(&self) -> Result<String, Error>;
    fn as_pkcs8_pem(&self) -> Result<String, Error>;
    fn as_pkcs1_pem_custom_ending(
        &self,
        line_ending: LineEnding,
    ) -> Result<String, Error>;
    fn as_pkcs8_pem_custom_ending(
        &self,
        line_ending: LineEnding,
    ) -> Result<String, Error>;
}
Expand description

Trait for encoding the keys and wrapping them in the PEM format

Required Methods§

Source

fn as_pkcs1_pem(&self) -> Result<String, Error>

Encode in the PKCS#1 format, PEM encoded

Source

fn as_pkcs8_pem(&self) -> Result<String, Error>

Encode in the PKCS#8 format, PEM encoded

Source

fn as_pkcs1_pem_custom_ending( &self, line_ending: LineEnding, ) -> Result<String, Error>

Encode in the PKCS#1 format, PEM encoded with a custom line ending

Source

fn as_pkcs8_pem_custom_ending( &self, line_ending: LineEnding, ) -> Result<String, Error>

Encode in the PKCS#8 format, PEM encoded with a custom line ending

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl PemEncode for RSAPrivateKey

Available on crate feature pem only.
Source§

fn as_pkcs1_pem(&self) -> Result<String, Error>

Line endings default to Unix-style LF

Source§

fn as_pkcs8_pem(&self) -> Result<String, Error>

Line endings default to Unix-style LF

Source§

fn as_pkcs1_pem_custom_ending( &self, line_ending: LineEnding, ) -> Result<String, Error>

Encode with a different line ending

Source§

fn as_pkcs8_pem_custom_ending( &self, line_ending: LineEnding, ) -> Result<String, Error>

Encode with a different line ending

Source§

impl PemEncode for RSAPublicKey

Available on crate feature pem only.
Source§

fn as_pkcs1_pem(&self) -> Result<String, Error>

Line endings default to Unix-style LF

Source§

fn as_pkcs8_pem(&self) -> Result<String, Error>

Line endings default to Unix-style LF

Source§

fn as_pkcs1_pem_custom_ending( &self, line_ending: LineEnding, ) -> Result<String, Error>

Encode with a different line ending

Source§

fn as_pkcs8_pem_custom_ending( &self, line_ending: LineEnding, ) -> Result<String, Error>

Encode with a different line ending

Implementors§