Struct pkcs8::SecretDocument
source · pub struct SecretDocument(/* private fields */);
Available on crate feature
alloc
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 as_bytes(&self) -> &[u8] ⓘ
Available on crate feature zeroize
only.
pub fn as_bytes(&self) -> &[u8] ⓘ
zeroize
only.Borrow the inner serialized bytes of this document.
sourcepub fn to_bytes(&self) -> Zeroizing<Vec<u8>>
Available on crate feature zeroize
only.
pub fn to_bytes(&self) -> Zeroizing<Vec<u8>>
zeroize
only.Return an allocated ASN.1 DER serialization as a byte vector.
sourcepub fn len(&self) -> Length
Available on crate feature zeroize
only.
pub fn len(&self) -> Length
zeroize
only.Get the length of the encoded ASN.1 DER in bytes.
sourcepub fn decode_msg<'a, T>(&'a self) -> Result<T, Error>where
T: Decode<'a>,
Available on crate feature zeroize
only.
pub fn decode_msg<'a, T>(&'a self) -> Result<T, Error>where
T: Decode<'a>,
zeroize
only.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,
Available on crate feature zeroize
only.
pub fn encode_msg<T>(msg: &T) -> Result<SecretDocument, Error>where
T: Encode,
zeroize
only.Encode the provided type as ASN.1 DER.
sourcepub fn read_der_file(path: impl AsRef<Path>) -> Result<SecretDocument, Error>
Available on crate features zeroize
and std
only.
pub fn read_der_file(path: impl AsRef<Path>) -> Result<SecretDocument, Error>
zeroize
and std
only.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
Available on crate feature zeroize
only.
impl Debug for SecretDocument
Available on crate feature
zeroize
only.source§impl Drop for SecretDocument
Available on crate feature zeroize
only.
impl Drop for SecretDocument
Available on crate feature
zeroize
only.source§impl From<Document> for SecretDocument
Available on crate feature zeroize
only.
impl From<Document> for SecretDocument
Available on crate feature
zeroize
only.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
Available on crate feature zeroize
only.
impl TryFrom<&[u8]> for SecretDocument
Available on crate feature
zeroize
only.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.
impl ZeroizeOnDrop for SecretDocument
Available on crate feature
zeroize
only.Auto Trait Implementations§
impl Freeze for SecretDocument
impl RefUnwindSafe for SecretDocument
impl Send for SecretDocument
impl Sync for SecretDocument
impl Unpin 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)