[−][src]Function asn1_der::der::try_decode_length
pub fn try_decode_length(data: &[u8]) -> Result<Option<(usize, usize)>>
Tries to decode the length of an DER-encoded object
This is especially useful if you don't have access to the full data yet (network-IO etc.) and you want to know how long the payload is.
Parameters:
data
: The beginning of the DER-encoded stream
Returns:
- On success:
Some((total_length, payload_length))
if the length was decoded successfullyNone
if there is not enough data available yet
- On error:
Asn1DerError::InvalidEncoding
if the length-field is invalidAsn1DerError::Unsupported
if the length is greater thanstd::usize::MAX