Function rocket::mtls::x509::der_parser::ber::parse_ber_with_tag
source · pub fn parse_ber_with_tag<T>(
i: &[u8],
tag: T
) -> Result<(&[u8], BerObject<'_>), Err<Error>>
Available on crate feature
mtls
only.Expand description
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::Tag;
use der_parser::ber::parse_ber_with_tag;
let bytes = &[0x02, 0x03, 0x01, 0x00, 0x01];
let (_, obj) = parse_ber_with_tag(bytes, Tag::Integer).expect("parsing failed");
assert_eq!(obj.header.tag(), Tag::Integer);