logo
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

Get the ASN.1 DER-encoded bytes of this document.

Convert to a SecretDocument.

Convert to an ASN.1 DER-encoded byte vector.

Return an ASN.1 DER-encoded byte vector.

Get the length of the encoded ASN.1 DER in bytes.

Try to decode the inner ASN.1 DER message contained in this Document as the given type.

Encode the provided type as ASN.1 DER, storing the resulting encoded DER as a Document.

Decode ASN.1 DER document from PEM.

Returns the PEM label and decoded Document on success.

Encode ASN.1 DER document as a PEM string with encapsulation boundaries containing the provided PEM type label (e.g. CERTIFICATE).

Read ASN.1 DER document from a file.

Write ASN.1 DER document to a file.

Read PEM-encoded ASN.1 DER document from a file.

Write PEM-encoded ASN.1 DER document to a file.

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Attempt to decode this message using the provided decoder.

Parse Self from the provided DER-encoded byte slice.

Compute the length of this value in bytes when encoded as ASN.1 DER.

Encode this value as ASN.1 DER using the provided Writer.

Encode this value to the provided byte slice, returning a sub-slice containing the encoded message. Read more

Encode this message as ASN.1 DER, appending it to the provided byte vector. Read more

Serialize this message as a byte vector.

ASN.1 tag

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Is the provided Tag decodable as a variant of this CHOICE?

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

Get the ASN.1 tag that this type is encoded with.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.