Function der_parser::der::parse_der_with_tag
source · pub fn parse_der_with_tag<T: Into<Tag>>(i: &[u8], tag: T) -> DerResult<'_>
Expand description
Parse a DER object, expecting a value with specified tag
The object is parsed recursively, with a maximum depth of MAX_RECURSION
.
§Example
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);