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

NAME

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

SYNTAX

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

DESCRIPTION

16       scan_asn1derlength  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       In  addition to reading the length value, this implementation will also
33       validate the length value. If the length value is  so  large  that  the
34       data  would not fit in the source buffer, it will return a failure.  If
35       you only want to  parse  the  length  value  without  this  check,  use
36       scan_asn1derlengthvalue() instead.
37

SEE ALSO

39       fmt_asn1derlength(3), scan_asn1derlengthvalue(3)
40
41
42
43                                                         scan_asn1derlength(3)
Impressum