Type Alias rocket::mtls::oid::asn1_rs::TaggedExplicit

source ·
pub type TaggedExplicit<T, const TAG: u32> = TaggedValue<T, Explicit, asn1_rs::::asn1_types::tagged::explicit::TaggedExplicit::{constant#0}, TAG>;
Available on crate feature mtls only.
Expand description

A helper object to parse [ n ] EXPLICIT T

A helper object implementing FromBer and FromDer, to parse tagged optional values.

This helper expects context-specific tags. See TaggedValue or TaggedParser for more generic implementations if needed.


To parse a [0] EXPLICIT INTEGER object:

use asn1_rs::{FromBer, Integer, TaggedExplicit, TaggedValue};

let bytes = &[0xa0, 0x03, 0x2, 0x1, 0x2];

// If tagged object is present (and has expected tag), parsing succeeds:
let (_, tagged) = TaggedExplicit::<Integer, 0>::from_ber(bytes).unwrap();
assert_eq!(tagged, TaggedValue::explicit(Integer::from(2)));

Aliased Type§

struct TaggedExplicit<T, const TAG: u32> { /* private fields */ }