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§
Sourcefn from_pkcs1_der(bytes: &[u8]) -> Result<Self>
fn from_pkcs1_der(bytes: &[u8]) -> Result<Self>
Decode a two-prime PKCS#1 key and validate it with sad-rsa.
Sourcefn to_pkcs1_der(&self) -> Result<SecretDocument>
fn to_pkcs1_der(&self) -> Result<SecretDocument>
Encode a borrowed key as PKCS#1 in a zeroizing document.
Sourcefn from_pkcs8_der(bytes: &[u8]) -> Result<Self>
fn from_pkcs8_der(bytes: &[u8]) -> Result<Self>
Decode a PKCS#8 key with a validated algorithm identifier.
Sourcefn to_pkcs8_der(&self) -> Result<SecretDocument>
fn to_pkcs8_der(&self) -> Result<SecretDocument>
Encode a borrowed key as PKCS#8 in a zeroizing document.
Provided Methods§
Sourcefn from_pkcs1_pem(pem: &str) -> Result<Self>
fn from_pkcs1_pem(pem: &str) -> Result<Self>
Decode a correctly labeled PKCS#1 PEM key.
Sourcefn to_pkcs1_pem(&self, ending: LineEnding) -> Result<Zeroizing<String>>
fn to_pkcs1_pem(&self, ending: LineEnding) -> Result<Zeroizing<String>>
Encode a PKCS#1 PEM key with explicit line endings.
Sourcefn from_pkcs8_pem(pem: &str) -> Result<Self>
fn from_pkcs8_pem(pem: &str) -> Result<Self>
Decode a correctly labeled PKCS#8 PEM key.
Sourcefn to_pkcs8_pem(&self, ending: LineEnding) -> Result<Zeroizing<String>>
fn to_pkcs8_pem(&self, ending: LineEnding) -> Result<Zeroizing<String>>
Encode a PKCS#8 PEM key with explicit line endings.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".