pub struct SecretDocument(/* private fields */);Available on crate features
pkcs8 and zeroize 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§
Source§impl SecretDocument
impl SecretDocument
Sourcepub fn to_bytes(&self) -> Zeroizing<Vec<u8>>
pub fn to_bytes(&self) -> Zeroizing<Vec<u8>>
Return an allocated ASN.1 DER serialization as a byte vector.
Sourcepub fn decode_msg<'a, T>(&'a self) -> Result<T, <T as Decode<'a>>::Error>where
T: Decode<'a>,
pub fn decode_msg<'a, T>(&'a self) -> Result<T, <T as Decode<'a>>::Error>where
T: Decode<'a>,
Try to decode the inner ASN.1 DER message as the given type.
§Errors
Returns T::Error if a decoding error occurred.
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,
Trait Implementations§
Source§impl Clone for SecretDocument
impl Clone for SecretDocument
Source§fn clone(&self) -> SecretDocument
fn clone(&self) -> SecretDocument
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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<'a, Params, Key, PubKey> TryFrom<&PrivateKeyInfo<Params, Key, PubKey>> for SecretDocumentwhere
Params: Choice<'a, Error = Error> + Encode,
Key: DecodeValue<'a, Error = Error> + FixedTag + 'a + EncodeValue,
PubKey: DecodeValue<'a, Error = Error> + FixedTag + 'a + BitStringLike,
Available on crate feature alloc only.
impl<'a, Params, Key, PubKey> TryFrom<&PrivateKeyInfo<Params, Key, PubKey>> for SecretDocumentwhere
Params: Choice<'a, Error = Error> + Encode,
Key: DecodeValue<'a, Error = Error> + FixedTag + 'a + EncodeValue,
PubKey: DecodeValue<'a, Error = Error> + FixedTag + 'a + BitStringLike,
Available on crate feature
alloc only.Source§impl<'a, Params, Key, PubKey> TryFrom<PrivateKeyInfo<Params, Key, PubKey>> for SecretDocumentwhere
Params: Choice<'a, Error = Error> + Encode,
Key: DecodeValue<'a, Error = Error> + FixedTag + 'a + EncodeValue,
PubKey: DecodeValue<'a, Error = Error> + FixedTag + 'a + BitStringLike,
Available on crate feature alloc only.
impl<'a, Params, Key, PubKey> TryFrom<PrivateKeyInfo<Params, Key, PubKey>> for SecretDocumentwhere
Params: Choice<'a, Error = Error> + Encode,
Key: DecodeValue<'a, Error = Error> + FixedTag + 'a + EncodeValue,
PubKey: DecodeValue<'a, Error = Error> + FixedTag + 'a + BitStringLike,
Available on crate feature
alloc only.impl ZeroizeOnDrop for SecretDocument
Auto Trait Implementations§
impl Freeze for SecretDocument
impl RefUnwindSafe for SecretDocument
impl Send for SecretDocument
impl Sync for SecretDocument
impl Unpin for SecretDocument
impl UnsafeUnpin for SecretDocument
impl UnwindSafe for SecretDocument
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more