pub struct AsnBuilder { /* private fields */ }Expand description
Implementations§
Source§impl AsnBuilder
impl AsnBuilder
Sourcepub fn big_integer(self, bytes: &[u8]) -> Self
pub fn big_integer(self, bytes: &[u8]) -> Self
Add a BigInteger value (raw bytes, two’s complement).
Sourcepub fn bit_string(self, data: &[u8], unused_bits: u8) -> Self
pub fn bit_string(self, data: &[u8], unused_bits: u8) -> Self
Add a BIT STRING value.
Sourcepub fn octet_string(self, data: &[u8]) -> Self
pub fn octet_string(self, data: &[u8]) -> Self
Add an OCTET STRING value.
Sourcepub fn utf8_string(self, s: &str) -> Self
pub fn utf8_string(self, s: &str) -> Self
Add a UTF8String value.
Sourcepub fn enumerated(self, value: i64) -> Self
pub fn enumerated(self, value: i64) -> Self
Add an ENUMERATED value.
Sourcepub fn context_specific(self, number: u8, data: &[u8]) -> Self
pub fn context_specific(self, number: u8, data: &[u8]) -> Self
Add a context-specific tagged value.
Sourcepub fn context_specific_value(self, number: u8, value: &AsnValue) -> Self
pub fn context_specific_value(self, number: u8, value: &AsnValue) -> Self
Add a context-specific tagged value wrapping an encoded ASN.1 value.
Sourcepub fn sequence<F>(self, f: F) -> Selfwhere
F: FnOnce(AsnBuilder) -> AsnBuilder,
pub fn sequence<F>(self, f: F) -> Selfwhere
F: FnOnce(AsnBuilder) -> AsnBuilder,
Add a nested SEQUENCE built with a closure.
Sourcepub fn set<F>(self, f: F) -> Selfwhere
F: FnOnce(AsnBuilder) -> AsnBuilder,
pub fn set<F>(self, f: F) -> Selfwhere
F: FnOnce(AsnBuilder) -> AsnBuilder,
Add a nested SET built with a closure.
Sourcepub fn build(self) -> Vec<u8>
pub fn build(self) -> Vec<u8>
Build the accumulated items.
If there is exactly one item, returns its encoded form. If there are multiple items, wraps them in a SEQUENCE.
Sourcepub fn build_value(self) -> AsnValue
pub fn build_value(self) -> AsnValue
Build and return the items as an AsnValue::Sequence.