[][src]Function asn1_der::der::decode_length

pub fn decode_length(
    length_bytes: &[u8]
) -> Result<(usize, usize), Error<Asn1DerError>>

Decodes an ASN.1-DER-encoded length

Parameters:

  • length_bytes: A slice over (but not limited to) the encoded length that begins with the first length-byte

Returns:

  • On success:
    • (payload_length, number_of_length_bytes)
  • On error:
    • Asn1DerError::InvalidEncoding if the length-field is invalid
    • Asn1DerError::NotEnoughBytes if the length-field is too short
    • Asn1DerError::Unsupported if the length is greater than std::usize::MAX