Portability Libraries  2015.2.0.0
Common Methods and Objects for Platform Independance.
BER/DER C Decode Functions.

Macros

#define xd_unsigned   xd_uint
 
#define xd_utf8str(pctxt, object_p, tagging, length)   xd_charstr (pctxt, (const char**)object_p, tagging, ASN_ID_UTF8String, length)
 

Functions

int decodeRelOID (OSCTXT *pctxt, ASN1OBJID *pvalue, ASN1TagType tagging, int length)
 
EXTERNRT int xd_16BitCharStr (OSCTXT *pctxt, Asn116BitCharString *pvalue, ASN1TagType tagging, ASN1TAG tag, int length)
 
EXTERNRT int xd_32BitCharStr (OSCTXT *pctxt, Asn132BitCharString *pvalue, ASN1TagType tagging, ASN1TAG tag, int length)
 
EXTERNRT int xd_bigint (OSCTXT *pctxt, const char **pvalue, ASN1TagType tagging, int length)
 
EXTERNRT int xd_bitstr (OSCTXT *pctxt, const OSOCTET **pvalue2, OSUINT32 *numbits_p, ASN1TagType tagging, int length)
 
EXTERNRT int xd_bitstr_s (OSCTXT *pctxt, OSOCTET *pvalue, OSUINT32 *numbits_p, ASN1TagType tagging, int length)
 
EXTERNRT int xd_boolean (OSCTXT *pctxt, OSBOOL *pvalue, ASN1TagType tagging, int length)
 
EXTERNRT int xd_charstr (OSCTXT *pctxt, const char **pvalue, ASN1TagType tagging, ASN1TAG tag, int length)
 
EXTERNRT int xd_chkend (OSCTXT *pctxt, ASN1CCB *ccb_p)
 
EXTERNRT int xd_count (OSCTXT *pctxt, int length, int *count_p)
 
EXTERNRT int xd_enum (OSCTXT *pctxt, OSINT32 *pvalue, ASN1TagType tagging, int length)
 
EXTERNRT int xd_enumUnsigned (OSCTXT *pctxt, OSUINT32 *object_p, ASN1TagType tagging, int length)
 
EXTERNRT int xd_int16 (OSCTXT *pctxt, OSINT16 *pvalue, ASN1TagType tagging, int length)
 
EXTERNRT int xd_int64 (OSCTXT *pctxt, OSINT64 *object_p, ASN1TagType tagging, int length)
 
EXTERNRT int xd_int8 (OSCTXT *pctxt, OSINT8 *pvalue, ASN1TagType tagging, int length)
 
EXTERNRT int xd_integer (OSCTXT *pctxt, OSINT32 *pvalue, ASN1TagType tagging, int length)
 
EXTERNRT int xd_len (OSCTXT *pctxt, int *len_p)
 
EXTERNRT int xd_match (OSCTXT *pctxt, ASN1TAG tag, int *len_p, OSOCTET flags)
 
EXTERNRT int xd_match1 (OSCTXT *pctxt, OSOCTET tag, int *len_p)
 
EXTERNRT int xd_memcpy (OSCTXT *pctxt, OSOCTET *pvalue, int length)
 
EXTERNRT int xd_NextElement (OSCTXT *pctxt)
 
EXTERNRT int xd_null (OSCTXT *pctxt, ASN1TagType tagging)
 
EXTERNRT int xd_objid (OSCTXT *pctxt, ASN1OBJID *pvalue, ASN1TagType tagging, int length)
 
EXTERNRT int xd_octstr (OSCTXT *pctxt, const OSOCTET **pvalue2, OSUINT32 *numocts_p, ASN1TagType tagging, int length)
 
EXTERNRT int xd_octstr_s (OSCTXT *pctxt, OSOCTET *pvalue, OSUINT32 *numocts_p, ASN1TagType tagging, int length)
 
EXTERNRT int xd_OpenType (OSCTXT *pctxt, const OSOCTET **pvalue2, OSUINT32 *numocts_p)
 
EXTERNRT int xd_OpenTypeExt (OSCTXT *pctxt, ASN1CCB *ccb_p, ASN1TAG tag, OSRTDList *pElemList)
 
EXTERNRT int xd_setp (OSCTXT *pctxt, const OSOCTET *msg_p, int msglen, ASN1TAG *tag_p, int *len_p)
 
EXTERNRT int xd_tag (OSCTXT *pctxt, ASN1TAG *tag_p)
 
EXTERNRT int xd_Tag1AndLen (OSCTXT *pctxt, OSINT32 *len_p)
 
EXTERNRT int xd_tag_len (OSCTXT *pctxt, ASN1TAG *tag_p, int *len_p, OSOCTET flags)
 
EXTERNRT int xd_uint (OSCTXT *pctxt, OSUINT32 *pvalue, ASN1TagType tagging, int length)
 
EXTERNRT int xd_uint16 (OSCTXT *pctxt, OSUINT16 *pvalue, ASN1TagType tagging, int length)
 
EXTERNRT int xd_uint64 (OSCTXT *pctxt, OSUINT64 *object_p, ASN1TagType tagging, int length)
 
EXTERNRT int xd_uint8 (OSCTXT *pctxt, OSUINT8 *pvalue, ASN1TagType tagging, int length)
 

Detailed Description

BER/DER C decode functions handle the decoding of the primitive ASN.1 data types and ASN.1 length and tag fields within a message. Calls to these functions are assembled in the C source code generated by the ASN1C compiler to decode complex ASN.1 structures. These functions are also directly callable from within a user's application program if the need to decode a primitive data item exists.

The procedure to decode a primitive data item is as follows:

  1. Call the xd_setp low-level decode function to specify the address of the buffer containing the encoded ASN.1 data to be decoded.
  2. Call the specific decode function to decode the value. The tag value obtained in the first step can be used to determine which decode function to call for decoding the variable.