Struct ed25519_dalek::pkcs8::spki::Document
pub struct Document { /* private fields */ }
Available on crate feature
pkcs8
only.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§
§impl Document
impl Document
pub fn into_secret(self) -> SecretDocument
Available on crate feature zeroize
only.
pub fn into_secret(self) -> SecretDocument
zeroize
only.Convert to a SecretDocument
.
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 contained in this
Document
as the given type.
pub 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§
§impl Encode for Document
impl Encode for Document
§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.
§fn encode(&self, writer: &mut impl Writer) -> Result<(), Error>
fn encode(&self, writer: &mut impl Writer) -> Result<(), Error>
Encode this value as ASN.1 DER using the provided
Writer
.§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.
§impl From<Document> for SecretDocument
Available on crate feature zeroize
only.
impl From<Document> for SecretDocument
Available on crate feature
zeroize
only.§fn from(doc: Document) -> SecretDocument
fn from(doc: Document) -> SecretDocument
Converts to this type from the input type.
§impl<'a, 'k, Params, Key> TryFrom<&SubjectPublicKeyInfo<Params, Key>> for Documentwhere
'a: 'k,
Key: 'k + Decode<'a> + Encode + FixedTag,
Params: Choice<'a> + Encode,
BitStringRef<'a>: From<&'k Key>,
Available on crate feature alloc
only.
impl<'a, 'k, Params, Key> TryFrom<&SubjectPublicKeyInfo<Params, Key>> for Documentwhere 'a: 'k, Key: 'k + Decode<'a> + Encode + FixedTag, Params: Choice<'a> + Encode, BitStringRef<'a>: From<&'k Key>,
Available on crate feature
alloc
only.§impl<'a, 'k, Params, Key> TryFrom<SubjectPublicKeyInfo<Params, Key>> for Documentwhere
'a: 'k,
Key: 'k + Decode<'a> + Encode + FixedTag,
Params: Choice<'a> + Encode,
BitStringRef<'a>: From<&'k Key>,
Available on crate feature alloc
only.
impl<'a, 'k, Params, Key> TryFrom<SubjectPublicKeyInfo<Params, Key>> for Documentwhere 'a: 'k, Key: 'k + Decode<'a> + Encode + FixedTag, Params: Choice<'a> + Encode, BitStringRef<'a>: From<&'k Key>,
Available on crate feature
alloc
only.impl Eq for Document
impl StructuralEq for Document
impl StructuralPartialEq for Document
Auto Trait Implementations§
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
§impl<'a, T> Choice<'a> for Twhere
T: Decode<'a> + FixedTag,
impl<'a, T> Choice<'a> for Twhere T: Decode<'a> + FixedTag,
§fn can_decode(tag: Tag) -> bool
fn can_decode(tag: Tag) -> bool
Is the provided
Tag
decodable as a variant of this CHOICE
?