rocket::mtls::x509::der

Function parse_der_explicit_optional

Source
pub fn parse_der_explicit_optional<F>(
    i: &[u8],
    tag: Tag,
    f: F,
) -> Result<(&[u8], BerObject<'_>), Err<Error>>
where F: Fn(&[u8]) -> Result<(&[u8], BerObject<'_>), Err<Error>>,
Available on crate feature mtls only.
Expand description

Parse an optional tagged object, applying function to get content

This function returns a DerObject, trying to read content as generic DER objects. If parsing failed, return an optional object containing None.

To support other return or error types, use parse_der_tagged_explicit_g

This function will never fail: if parsing content failed, the BER value Optional(None) is returned.