Struct pkcs8::PrivateKeyDocument [−][src]
alloc
only.PKCS#8 private key document.
This type provides storage for PrivateKeyInfo
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 private_key_info(&self) -> PrivateKeyInfo<'_>
[src]
Parse the PrivateKeyInfo
contained in this PrivateKeyDocument
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]
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]
pem
only.Serialize PrivateKeyDocument
as self-zeroizing PEM-encoded PKCS#8 string.
pub fn read_der_file(path: impl AsRef<Path>) -> Result<Self>
[src]
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]
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]
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]
pem
and std
only.Write PEM-encoded PKCS#8 private key to the given path
pub fn encrypt(
&self,
rng: impl CryptoRng + RngCore,
password: impl AsRef<[u8]>
) -> Result<EncryptedPrivateKeyDocument>
[src]
&self,
rng: impl CryptoRng + RngCore,
password: impl AsRef<[u8]>
) -> Result<EncryptedPrivateKeyDocument>
encryption
only.Encrypt this private key using a symmetric encryption key derived from the provided password.
pub fn encrypt_with_params(
&self,
pbes2_params: Parameters<'_>,
password: impl AsRef<[u8]>
) -> Result<EncryptedPrivateKeyDocument>
[src]
&self,
pbes2_params: Parameters<'_>,
password: impl AsRef<[u8]>
) -> Result<EncryptedPrivateKeyDocument>
encryption
only.Encrypt this private key using a symmetric encryption key derived
from the provided password and pbes2::Parameters
.
Trait Implementations
impl AsRef<[u8]> for PrivateKeyDocument
[src]
impl Clone for PrivateKeyDocument
[src]
fn clone(&self) -> PrivateKeyDocument
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for PrivateKeyDocument
[src]
impl From<&'_ PrivateKeyInfo<'_>> for PrivateKeyDocument
[src]
fn from(private_key_info: &PrivateKeyInfo<'_>) -> PrivateKeyDocument
[src]
impl From<PrivateKeyInfo<'_>> for PrivateKeyDocument
[src]
fn from(private_key_info: PrivateKeyInfo<'_>) -> PrivateKeyDocument
[src]
impl FromStr for PrivateKeyDocument
[src]
pem
only.type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self>
[src]
impl TryFrom<&'_ [u8]> for PrivateKeyDocument
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(bytes: &[u8]) -> Result<Self>
[src]
impl TryFrom<Vec<u8, Global>> for PrivateKeyDocument
[src]
Auto Trait Implementations
impl RefUnwindSafe for PrivateKeyDocument
impl Send for PrivateKeyDocument
impl Sync for PrivateKeyDocument
impl Unpin for PrivateKeyDocument
impl UnwindSafe for PrivateKeyDocument
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,