[][src]Function der_parser::ber::parse_ber_with_tag

pub fn parse_ber_with_tag<Tag: Into<BerTag>>(
    i: &[u8],
    tag: Tag
) -> BerResult<'_>

Parse a BER object, expecting a value with specified tag

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

Example

use der_parser::ber::BerTag;
use der_parser::ber::parse_ber_with_tag;

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

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