Function rocket::mtls::x509::ber::parse_ber_recursive

source ·
pub fn parse_ber_recursive(
    i: &[u8],
    max_depth: usize,
) -> Result<(&[u8], BerObject<'_>), Err<Error>>
Available on crate feature mtls only.
Expand description

Parse BER object recursively, specifying the maximum recursion depth

Return a tuple containing the remaining (unparsed) bytes and the BER Object, or an error.

§Example

use der_parser::ber::{parse_ber_recursive, Tag};

let bytes = &[0x02, 0x03, 0x01, 0x00, 0x01];
let (_, obj) = parse_ber_recursive(bytes, 1).expect("parsing failed");

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