pub struct Encoder<'a> { /* private fields */ }
Expand description
DER encoder.
Implementations
Create a new encoder with the given byte slice as a backing buffer.
Encode a value which impls the Encodable
trait.
Return an error with the given ErrorKind
, annotating it with
context about where the error occurred.
Return an error for an invalid value with the given tag.
Finish encoding to the buffer, returning a slice containing the data written to the buffer.
Encode the provided value as an ASN.1 BIT STRING
.
pub fn context_specific<T>(
&mut self,
tag_number: TagNumber,
tag_mode: TagMode,
value: &T
) -> Result<()> where
T: EncodeValue + Tagged,
pub fn context_specific<T>(
&mut self,
tag_number: TagNumber,
tag_mode: TagMode,
value: &T
) -> Result<()> where
T: EncodeValue + Tagged,
Encode a CONTEXT-SPECIFIC
field with EXPLICIT
tagging.
Encode the provided value as an ASN.1 GeneralizedTime
Encode the provided value as an ASN.1 IA5String
.
Encode the provided value as an ASN.1 OCTET STRING
This is supported on crate feature oid
only.
oid
only.Encode an ASN.1 ObjectIdentifier
Encode the provided value as an ASN.1 PrintableString
Encode an ASN.1 SEQUENCE
of the given length.
Spawns a nested Encoder
which is expected to be exactly the
specified length upon completion.
Encode the provided value as an ASN.1 UTCTime
Encode the provided value as an ASN.1 Utf8String