Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
scan_asn1derlength(3)	    Library Functions Manual	   scan_asn1derlength(3)

NAME
     scan_asn1derlengthvalue  - decode an unsigned integer from ASN.1 DER length
     encoding

SYNTAX
     #include <libowfat/scan.h>

     size_t scan_asn1derlengthvalue(const  char  *src,size_t  len,unsigned  long
     long *dest);

DESCRIPTION
     scan_asn1derlengthvalue decodes an unsigned integer in ASN.1 DER length en-
     coding  from a memory area holding binary data.  It writes the decode value
     in dest and returns the number of bytes it read from src.

     scan_asn1derlength never reads more than len bytes from src.   If	the  se-
     quence  is  longer  than  that,  or the memory area contains an invalid se-
     quence, scan_asn1derlength returns 0 and does not touch dest.

     The length of the longest spec-compliant ASN.1 DER length is 128 bytes, but
     this implementation will return an error if the value does not fit into the
     target integer type.  In practice the largest sequence is sizeof(*dest)+1.

     This implementation will reject values that are not encoded in the  minimum
     amount of bytes.

     If  you  need  to	decode	the  length  value so you can parse actual ASN.1
     tag/length/value structures, please consider using  scan_asn1derlength  in-
     stead, as it will do additional checking for you.

SEE ALSO
     fmt_asn1derlength(3), scan_asn1derlengthvalue(3)

							   scan_asn1derlength(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=libowfat_scan_asn1derlengthvalue&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help