Struct pkcs8::SecretDocument
source · pub struct SecretDocument(_);
Expand description
Secret Document
type.
Useful for formats which represent potentially secret data, such as cryptographic keys.
This type provides additional hardening such as ensuring that the contents are zeroized-on-drop, and also using more restrictive file permissions when writing files to disk.
Implementations§
source§impl SecretDocument
impl SecretDocument
sourcepub fn to_bytes(&self) -> Zeroizing<Vec<u8, Global>>
pub fn to_bytes(&self) -> Zeroizing<Vec<u8, Global>>
Return an allocated ASN.1 DER serialization as a byte vector.
sourcepub fn decode_msg<'a, T>(&'a self) -> Result<T, Error>where
T: Decode<'a>,
pub fn decode_msg<'a, T>(&'a self) -> Result<T, Error>where
T: Decode<'a>,
Try to decode the inner ASN.1 DER message as the given type.
sourcepub fn encode_msg<T>(msg: &T) -> Result<SecretDocument, Error>where
T: Encode,
pub fn encode_msg<T>(msg: &T) -> Result<SecretDocument, Error>where
T: Encode,
Encode the provided type as ASN.1 DER.
sourcepub fn read_der_file(path: impl AsRef<Path>) -> Result<SecretDocument, Error>
pub fn read_der_file(path: impl AsRef<Path>) -> Result<SecretDocument, Error>
Read ASN.1 DER document from a file.
Trait Implementations§
source§impl Clone for SecretDocument
impl Clone for SecretDocument
source§fn clone(&self) -> SecretDocument
fn clone(&self) -> SecretDocument
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for SecretDocument
impl Debug for SecretDocument
source§impl Drop for SecretDocument
impl Drop for SecretDocument
source§impl From<Document> for SecretDocument
impl From<Document> for SecretDocument
source§fn from(doc: Document) -> SecretDocument
fn from(doc: Document) -> SecretDocument
Converts to this type from the input type.
source§impl TryFrom<&[u8]> for SecretDocument
impl TryFrom<&[u8]> for SecretDocument
source§impl TryFrom<&PrivateKeyInfo<'_>> for SecretDocument
impl TryFrom<&PrivateKeyInfo<'_>> for SecretDocument
source§fn try_from(private_key: &PrivateKeyInfo<'_>) -> Result<SecretDocument>
fn try_from(private_key: &PrivateKeyInfo<'_>) -> Result<SecretDocument>
Performs the conversion.
source§impl TryFrom<PrivateKeyInfo<'_>> for SecretDocument
impl TryFrom<PrivateKeyInfo<'_>> for SecretDocument
source§fn try_from(private_key: PrivateKeyInfo<'_>) -> Result<SecretDocument>
fn try_from(private_key: PrivateKeyInfo<'_>) -> Result<SecretDocument>
Performs the conversion.