rocket::mtls::x509::ber

Function ber_read_element_header

Source
pub fn ber_read_element_header(
    i: &[u8],
) -> Result<(&[u8], Header<'_>), Err<Error>>
Available on crate feature mtls only.
Expand description

Read an object header

ยงExample

let bytes = &[0x02, 0x03, 0x01, 0x00, 0x01];
let (i, hdr) = ber_read_element_header(bytes).expect("could not read header");

assert_eq!(hdr.class(), Class::Universal);
assert_eq!(hdr.tag(), Tag::Integer);
assert_eq!(hdr.length(), Length::Definite(3));