Go to the source code of this file.
Functions | |
CONST u_char * | AsnHeaderParse (CONST u_char *data, size_t *datalength, u_char *type) |
Interpret the ID and length of the next object. | |
u_char * | AsnHeaderBuild (u_char *data, size_t *datalength, u_char type, size_t length) |
Build an ASN header for an object with a given ID and length. | |
CONST u_char * | AsnSequenceParse (CONST u_char *data, size_t *datalength, u_char type) |
Check the type and get the length of the next object. | |
u_char * | AsnSequenceBuild (u_char *data, size_t *datalength, u_char type, size_t length) |
Build an ASN header for a sequence with a given type and length. | |
CONST u_char * | AsnIntegerParse (CONST u_char *data, size_t *datalength, u_char *type, long *intp) |
Pull a long out of an ASN integer type. | |
u_char * | AsnIntegerBuild (u_char *data, size_t *datalength, u_char type, long *intp) |
Build an ASN object containing an integer. | |
CONST u_char * | AsnUnsignedParse (CONST u_char *data, size_t *datalength, u_char *type, u_long *intp) |
Pull an unsigned long out of an ASN integer type. | |
u_char * | AsnUnsignedBuild (u_char *data, size_t *datalength, u_char type, u_long *intp) |
Build an ASN object containing an unsigned integer. | |
CONST u_char * | AsnOctetStringParse (CONST u_char *data, size_t *datalength, u_char *type, u_char *string, size_t *strlength) |
Pulls a string out of an ASN octet string type. | |
u_char * | AsnOctetStringBuild (u_char *data, size_t *datalength, u_char type, CONST u_char *string, size_t strlength) |
Build an ASN object containing an octet string. | |
CONST u_char * | AsnOidParse (CONST u_char *data, size_t *datalength, u_char *type, OID *objid, size_t *objidlength) |
Pulls an object identifier out of an ASN object ID type. | |
u_char * | AsnOidBuild (u_char *data, size_t *datalength, u_char type, CONST OID *objid, size_t objidlength) |
Build an ASN object identifier. | |
CONST u_char * | AsnNullParse (CONST u_char *data, size_t *datalength, u_char *type) |
Parse an ASN null type. | |
u_char * | AsnNullBuild (u_char *data, size_t *datalength, u_char type) |
Build an ASN null object. | |
CONST u_char * | AsnBitStringParse (CONST u_char *data, size_t *datalength, u_char *type, u_char *string, size_t *strlength) |
Pull a bitstring out of an ASN bitstring type. | |
u_char * | AsnBitStringBuild (u_char *data, size_t *datalength, u_char type, CONST u_char *string, size_t strlength) |
Build an ASN bit string. | |
CONST u_char * | AsnUnsigned64Parse (CONST u_char *data, size_t *datalength, u_char *type, UNSIGNED64 *cp) |
Pull a 64 bit unsigned long out of an ASN integer type. | |
u_char * | AsnUnsigned64Build (u_char *data, size_t *datalength, u_char type, CONST UNSIGNED64 *cp) |
Build an ASN object containing a 64 bit unsigned integer. |
Interpret the ID and length of the next object.
data | Pointer to start of the object. | |
datalength | Contains the number of valid bytes following the start of the object. On exit, it is returned as the number of valid bytes following the ID and length. | |
type | Pointer to the variable that receives the ASN type of the object. |
Definition at line 135 of file asn1.c.
References ASN_EXTENSION_ID, and CONST.
Build an ASN header for an object with a given ID and length.
This only works on data types < 30, i.e. no extension octets. The maximum length is 0xFFFF;
data | Pointer to start of object. | |
datalength | Contains the number of available bytes following the start of the object. On exit, it is returned as the number of available bytes following the encoded ID and length of this object. | |
type | ASN type of the object. | |
length | Length of object. |
Check the type and get the length of the next object.
Similare to AsnHeaderParse, but tests for expected type.
data | Pointer to start of the object. | |
datalength | Contains the number of valid bytes following the start of the object. On exit, it is returned as the number of valid bytes following the ID and length. | |
type | The expected ASN type of the object. |
Definition at line 214 of file asn1.c.
References AsnHeaderParse().
Build an ASN header for a sequence with a given type and length.
This only works on data types < 30, i.e. no extension octets. The maximum length is 0xFFFF;
data | Pointer to start of object. | |
datalength | Contains the number of available bytes following the start of the object. On exit, it is returned as the number of available bytes following the encoded ID and length of this object. | |
type | ASN type of the object. | |
length | Length of object. |
CONST u_char* AsnIntegerParse | ( | CONST u_char * | data, | |
size_t * | datalength, | |||
u_char * | type, | |||
long * | intp | |||
) |
Pull a long out of an ASN integer type.
data | Pointer to start of the object. | |
datalength | Contains the number of valid bytes following the start of the object. On exit, it is returned as the number of valid bytes following the end of this object. | |
type | Pointer to the variable that receives the ASN type of the object. | |
intp | Pointer to the variable that receives the value of the object. |
Definition at line 276 of file asn1.c.
References CONST.
Build an ASN object containing an integer.
data | Pointer to start of output buffer | |
datalength | Contains the number of available bytes following the start of the object. On exit, it is returned as the number of available bytes following the end of this object. | |
type | ASN type of the object. | |
intp | Value of the object. |
Definition at line 322 of file asn1.c.
References AsnHeaderBuild().
CONST u_char* AsnUnsignedParse | ( | CONST u_char * | data, | |
size_t * | datalength, | |||
u_char * | type, | |||
u_long * | intp | |||
) |
Pull an unsigned long out of an ASN integer type.
data | Pointer to start of the object. | |
datalength | Contains the number of valid bytes following the start of the object. On exit, it is returned as the number of valid bytes following the end of this object. | |
type | Pointer to the variable that receives the ASN type of the object. | |
intp | Pointer to the variable that receives the value of the object. |
Definition at line 374 of file asn1.c.
References CONST.
Build an ASN object containing an unsigned integer.
data | Pointer to start of output buffer | |
datalength | Contains the number of available bytes following the start of the object. On exit, it is returned as the number of available bytes following the end of this object. | |
type | ASN type of the object. | |
intp | Value of the object. |
Definition at line 424 of file asn1.c.
References AsnHeaderBuild().
CONST u_char* AsnOctetStringParse | ( | CONST u_char * | data, | |
size_t * | datalength, | |||
u_char * | type, | |||
u_char * | string, | |||
size_t * | strlength | |||
) |
Pulls a string out of an ASN octet string type.
data | Pointer to start of the object. | |
datalength | Contains the number of valid bytes following the start of the object. On exit, it is returned as the number of valid bytes following the end of this object. | |
type | Pointer to the variable that receives the ASN type of the object. | |
string | Pointer to the variable that receives the value of the object. | |
strlength | Contains the size of the string buffer on entry. On exit, it is returned as the number of bytes stored in the string buffer. |
u_char* AsnOctetStringBuild | ( | u_char * | data, | |
size_t * | datalength, | |||
u_char | type, | |||
CONST u_char * | string, | |||
size_t | strlength | |||
) |
Build an ASN object containing an octet string.
data | Pointer to start of output buffer | |
datalength | Contains the number of available bytes following the start of the object. On exit, it is returned as the number of available bytes following the end of this object. | |
type | ASN type of the object. | |
string | Pointer to the value. If NULL, the octet string will be filled with zeros. | |
strlength | Number of bytes in the string value. |
Definition at line 532 of file asn1.c.
References AsnHeaderBuild(), memcpy(), and memset().
CONST u_char* AsnOidParse | ( | CONST u_char * | data, | |
size_t * | datalength, | |||
u_char * | type, | |||
OID * | objid, | |||
size_t * | objidlength | |||
) |
Pulls an object identifier out of an ASN object ID type.
data | Pointer to start of the object. | |
datalength | Contains the number of valid bytes following the start of the object. On exit, it is returned as the number of valid bytes following the end of this object. | |
type | Pointer to the variable that receives the ASN type of the object. | |
objid | Pointer to the variable that receives the object identifier. | |
objidlength | Points to a variable that contains the size of the output buffer on entry. On exit, it is returned as the number of sub IDs stored in the output buffer. |
u_char* AsnOidBuild | ( | u_char * | data, | |
size_t * | datalength, | |||
u_char | type, | |||
CONST OID * | objid, | |||
size_t | objidlength | |||
) |
Build an ASN object identifier.
data | Pointer to start of the object. | |
datalength | Contains the number of available bytes following the start of the object. On exit, it is returned as the number of available bytes following the end of this object. | |
type | ASN type of the object. | |
objid | Pointer to the object identifier. | |
objidlength | Number of sub IDs in the object identifier. |
Definition at line 649 of file asn1.c.
References AsnHeaderBuild(), CONST, free, malloc, and MAX_OID_LEN.
Parse an ASN null type.
data | Pointer to start of the object. | |
datalength | Contains the number of valid bytes following the start of the object. On exit, it is returned as the number of valid bytes following the end of this object. | |
type | Pointer to the variable that receives the ASN type of the object. |
Definition at line 774 of file asn1.c.
References CONST.
Build an ASN null object.
data | Pointer to start of the object. | |
datalength | Contains the number of available bytes following the start of the object. On exit, it is returned as the number of available bytes following the end of this object. | |
type | ASN type of the object. |
Definition at line 805 of file asn1.c.
References AsnHeaderBuild().
CONST u_char* AsnBitStringParse | ( | CONST u_char * | data, | |
size_t * | datalength, | |||
u_char * | type, | |||
u_char * | string, | |||
size_t * | strlength | |||
) |
Pull a bitstring out of an ASN bitstring type.
data | Pointer to start of the object. | |
datalength | Contains the number of valid bytes following the start of the object. On exit, it is returned as the number of valid bytes following the end of this object. | |
type | Pointer to the variable that receives the ASN type of the object. | |
string | Pointer to the variable that receives the value of the object. | |
strlength | Contains the size of the string buffer on entry. On exit, it is returned as the number of bytes stored in the string buffer. |
u_char* AsnBitStringBuild | ( | u_char * | data, | |
size_t * | datalength, | |||
u_char | type, | |||
CONST u_char * | string, | |||
size_t | strlength | |||
) |
Build an ASN bit string.
data | Pointer to start of output buffer | |
datalength | Contains the number of available bytes following the start of the object. On exit, it is returned as the number of available bytes following the end of this object. | |
type | ASN type of the object. | |
string | Pointer to the value. If NULL, the octet string will be filled with zeros. | |
strlength | Number of bytes in the string value. |
Definition at line 872 of file asn1.c.
References AsnHeaderBuild(), and memcpy().
CONST u_char* AsnUnsigned64Parse | ( | CONST u_char * | data, | |
size_t * | datalength, | |||
u_char * | type, | |||
UNSIGNED64 * | cp | |||
) |
Pull a 64 bit unsigned long out of an ASN integer type.
data | Pointer to start of the object. | |
datalength | Contains the number of valid bytes following the start of the object. On exit, it is returned as the number of valid bytes following the end of this object. | |
type | Pointer to the variable that receives the ASN type of the object. | |
intp | Pointer to the variable that receives the value of the object. |
Definition at line 905 of file asn1.c.
References CONST, UNSIGNED64::high, and UNSIGNED64::low.
u_char* AsnUnsigned64Build | ( | u_char * | data, | |
size_t * | datalength, | |||
u_char | type, | |||
CONST UNSIGNED64 * | cp | |||
) |
Build an ASN object containing a 64 bit unsigned integer.
data | Pointer to start of output buffer | |
datalength | Contains the number of available bytes following the start of the object. On exit, it is returned as the number of available bytes following the end of this object. | |
type | ASN type of the object. | |
intp | Value of the object. |
Definition at line 952 of file asn1.c.
References AsnHeaderBuild().