pub fn parse_der_with_tag<T>(
    i: &[u8],
    tag: T
) -> Result<(&[u8], BerObject<'_>), Err<Error>> where
    T: Into<Tag>, 
Available on crate feature mtls only.
Expand description

Parse a DER object, expecting a value with specified tag

The object is parsed recursively, with a maximum depth of MAX_RECURSION.


use der_parser::der::{parse_der_with_tag, Tag};

let bytes = &[0x02, 0x03, 0x01, 0x00, 0x01];
let (_, obj) = parse_der_with_tag(bytes, Tag::Integer).expect("parsing failed");

assert_eq!(obj.header.tag(), Tag::Integer);