1scan_asn1derlength(3)      Library Functions Manual      scan_asn1derlength(3)
2
3
4

NAME

6       scan_asn1derlengthvalue  -  decode  an  unsigned integer from ASN.1 DER
7       length encoding
8

SYNTAX

10       #include <scan.h>
11
12       size_t scan_asn1derlengthvalue(const char *src,size_t len,unsigned long
13       long *dest);
14

DESCRIPTION

16       scan_asn1derlengthvalue decodes an unsigned integer in ASN.1 DER length
17       encoding from a memory area holding binary data.  It writes the  decode
18       value in dest and returns the number of bytes it read from src.
19
20       scan_asn1derlength  never  reads  more than len bytes from src.  If the
21       sequence is longer than that, or the memory area  contains  an  invalid
22       sequence, scan_asn1derlength returns 0 and does not touch dest.
23
24       The length of the longest spec-compliant ASN.1 DER length is 128 bytes,
25       but this implementation will return an error if the value does not  fit
26       into  the  target  integer  type.   In practice the largest sequence is
27       sizeof(*dest)+1.
28
29       This implementation will reject values that are not encoded in the min‐
30       imum amount of bytes.
31
32       If  you  need  to decode the length value so you can parse actual ASN.1
33       tag/length/value structures, please consider  using  scan_asn1derlength
34       instead, as it will do additional checking for you.
35

SEE ALSO

37       fmt_asn1derlength(3), scan_asn1derlengthvalue(3)
38
39
40
41                                                         scan_asn1derlength(3)
Impressum