pub fn parse_der_tagged_explicit_g<'a, T, Output, F, E>(
tag: T,
f: F,
) -> impl FnMut(&'a [u8]) -> IResult<&'a [u8], Output, E>
Expand description
Read a TAGGED EXPLICIT value (generic version)
The following parses [2] EXPLICIT INTEGER
:
fn parse_int_explicit(i:&[u8]) -> BerResult<u32> {
parse_der_tagged_explicit_g(2, move |content, hdr| {
let (rem, obj) = parse_der_integer(content)?;
let value = obj.as_u32()?;
Ok((rem, value))
})(i)
}
let res = parse_int_explicit(bytes);