rocket::mtls::x509::der_parser::der

Function parse_der_content

Source
pub fn parse_der_content<'a>(tag: Tag) -> impl Fn(&'a [u8], &Header<'_>, usize)
Available on crate feature mtls only.
Expand description

Parse the next bytes as the content of a DER object (combinator, header reference)

Content type is not checked to match tag, caller is responsible of providing the correct tag

Caller is also responsible to check if parsing function consumed the expected number of bytes (header.len).

This function differs from parse_der_content2 because it passes the BER object header by reference (required for ex. by parse_der_implicit).

The arguments of the parse function are: (input, ber_object_header, max_recursion).

Example: manually parsing header and content

let (i, header) = der_read_element_header(bytes).expect("parsing failed");
let (rem, content) = parse_der_content(header.tag())(i, &header, MAX_RECURSION)
    .expect("parsing failed");