pub fn parse_der_tagged_explicit<'a, T, F>(tag: T, f: F) -> impl FnMut(&'a [u8])
where F: Fn(&'a [u8]) -> Result<(&'a [u8], BerObject<'a>), Err<Error>>, T: Into<Tag>,
Available on crate feature mtls only.
Expand description

Read a TAGGED EXPLICIT value (combinator)

The built object will use the outer header (and tag), and contains a Tagged object with class, value and content.

For a generic version (different output and error types), see parse_der_tagged_explicit_g.

The following parses [2] EXPLICIT INTEGER:

use nom::combinator::map_res;
fn parse_int_explicit(i:&[u8]) -> BerResult<u32> {
   map_res(
       parse_der_tagged_explicit(2, parse_der_integer),
       |x: DerObject| x.as_tagged()?.2.as_u32()
   )(i)
}

let res = parse_int_explicit(bytes);