Struct ed25519::pkcs8::SecretDocument
pub struct SecretDocument(_);
Available on crate features
alloc
and zeroize
and pkcs8
only.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§
§impl SecretDocument
impl SecretDocument
pub 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.
pub fn len(&self) -> Length
pub fn len(&self) -> Length
Get the length of the encoded ASN.1 DER in bytes.
pub 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.
pub 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.
pub fn from_pem(pem: &str) -> Result<(&str, SecretDocument), Error>
Available on crate feature pem
only.
pub fn from_pem(pem: &str) -> Result<(&str, SecretDocument), Error>
pem
only.Decode ASN.1 DER document from PEM.
Trait Implementations§
§impl Clone for SecretDocument
impl Clone for SecretDocument
§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 more§impl Debug for SecretDocument
impl Debug for SecretDocument
§impl From<Document> for SecretDocument
impl From<Document> for SecretDocument
§fn from(doc: Document) -> SecretDocument
fn from(doc: Document) -> SecretDocument
Converts to this type from the input type.
§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, Error>
fn try_from(private_key: &PrivateKeyInfo<'_>) -> Result<SecretDocument, Error>
Performs the conversion.
source§impl TryFrom<PrivateKeyInfo<'_>> for SecretDocument
impl TryFrom<PrivateKeyInfo<'_>> for SecretDocument
source§fn try_from(private_key: PrivateKeyInfo<'_>) -> Result<SecretDocument, Error>
fn try_from(private_key: PrivateKeyInfo<'_>) -> Result<SecretDocument, Error>
Performs the conversion.