pub struct Document { /* private fields */ }
Expand description
ASN.1 DER-encoded document.
This type wraps an encoded ASN.1 DER message. The document checked to
ensure it contains a valid DER-encoded SEQUENCE
.
It implements common functionality related to encoding/decoding such documents, such as PEM encapsulation as well as reading/writing documents from/to the filesystem.
The SecretDocument
provides a wrapper for this type with additional
hardening applied.
Implementations§
Source§impl Document
impl Document
Sourcepub fn into_secret(self) -> SecretDocument
pub fn into_secret(self) -> SecretDocument
Convert to a SecretDocument
.
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 contained in this
Document
as the given type.
Sourcepub fn encode_msg<T>(msg: &T) -> Result<Document, Error>where
T: Encode,
pub fn encode_msg<T>(msg: &T) -> Result<Document, Error>where
T: Encode,
Encode the provided type as ASN.1 DER, storing the resulting encoded DER
as a Document
.
Trait Implementations§
Source§impl Encode for Document
impl Encode for Document
Source§fn encoded_len(&self) -> Result<Length, Error>
fn encoded_len(&self) -> Result<Length, Error>
Compute the length of this value in bytes when encoded as ASN.1 DER.
Source§fn encode(&self, writer: &mut dyn Writer) -> Result<(), Error>
fn encode(&self, writer: &mut dyn Writer) -> Result<(), Error>
Encode this value as ASN.1 DER using the provided
Writer
.Source§fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
Encode this value to the provided byte slice, returning a sub-slice
containing the encoded message.
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.
§impl TryFrom<&SubjectPublicKeyInfo<'_>> for Document
impl TryFrom<&SubjectPublicKeyInfo<'_>> for Document
§impl TryFrom<SubjectPublicKeyInfo<'_>> for Document
impl TryFrom<SubjectPublicKeyInfo<'_>> for Document
impl Eq for Document
impl StructuralPartialEq for Document
Auto Trait Implementations§
impl Freeze for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnwindSafe for Document
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)