BER/DER C Encode Functions.
[BER Runtime Library Functions.]
Detailed Description
BER/DER C encode functions handle the BER encoding 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 complier to accomplish the encoding of complex ASN.1 structures. These functions are also directly callable from within a user's application program if the need to accomplish a low level encoding function exists.The procedure to call the encode function that encodes a primitive type is the same as the procedure to call a compiler generated encode function described above. The rtxInitContext and xe_setp functions must first be called to initialize a context variable and set a pointer to the buffer into which the variable is to be encoded. A static encode buffer is specified by specifying a pointer to a buffer and buffer size. Setting the buffer address to NULL and buffer size to 0 specifies a dynamic buffer. The primitive encode function is invoked. Finally, xe_getp is called to retrieve a pointer to the encoded message compound.
Defines | |
| #define | xe_utf8str(pctxt, object_p, tagging) xe_charstr (pctxt, (const char*)object_p, tagging, ASN_ID_UTF8String) |
Functions | |
| int | xe_tag_len (OSCTXT *pctxt, ASN1TAG tag, int length) |
| int | xe_boolean (OSCTXT *pctxt, OSBOOL *object_p, ASN1TagType tagging) |
| int | xe_integer (OSCTXT *pctxt, int *object_p, ASN1TagType tagging) |
| int | xe_unsigned (OSCTXT *pctxt, OSUINT32 *object_p, ASN1TagType tagging) |
| int | xe_int8 (OSCTXT *pctxt, OSINT8 *object_p, ASN1TagType tagging) |
| int | xe_int16 (OSCTXT *pctxt, OSINT16 *object_p, ASN1TagType tagging) |
| int | xe_int64 (OSCTXT *pctxt, OSINT64 *object_p, ASN1TagType tagging) |
| int | xe_uint64 (OSCTXT *pctxt, OSUINT64 *object_p, ASN1TagType tagging) |
| int | xe_uint8 (OSCTXT *pctxt, OSUINT8 *object_p, ASN1TagType tagging) |
| int | xe_uint16 (OSCTXT *pctxt, OSUINT16 *object_p, ASN1TagType tagging) |
| int | xe_bigint (OSCTXT *pctxt, const char *object_p, ASN1TagType tagging) |
| int | xe_bitstr (OSCTXT *pctxt, const OSOCTET *object_p, OSUINT32 numbits, ASN1TagType tagging) |
| int | xe_octstr (OSCTXT *pctxt, const OSOCTET *object_p, OSUINT32 numocts, ASN1TagType tagging) |
| int | xe_charstr (OSCTXT *pctxt, const char *object_p, ASN1TagType tagging, ASN1TAG tag) |
| int | xe_16BitCharStr (OSCTXT *pctxt, Asn116BitCharString *object_p, ASN1TagType tagging, ASN1TAG tag) |
| int | xe_32BitCharStr (OSCTXT *pctxt, Asn132BitCharString *object_p, ASN1TagType tagging, ASN1TAG tag) |
| int | xe_null (OSCTXT *pctxt, ASN1TagType tagging) |
| int | xe_objid (OSCTXT *pctxt, ASN1OBJID *object_p, ASN1TagType tagging) |
| int | xe_oid64 (OSCTXT *pctxt, ASN1OID64 *object_p, ASN1TagType tagging) |
| int | xe_reloid (OSCTXT *pctxt, ASN1OBJID *object_p, ASN1TagType tagging) |
| int | xe_enum (OSCTXT *pctxt, OSINT32 *object_p, ASN1TagType tagging) |
| int | xe_real (OSCTXT *pctxt, OSREAL *object_p, ASN1TagType tagging) |
| int | xe_OpenType (OSCTXT *pctxt, const OSOCTET *object_p, OSUINT32 numocts) |
| int | xe_OpenTypeExt (OSCTXT *pctxt, OSRTDList *pElemList) |
| int | xe_real10 (OSCTXT *pctxt, const char *object_p, ASN1TagType tagging) |
| int | xe_derReal10 (OSCTXT *pctxt, const char *object_p, ASN1TagType tagging) |
| int | xe_setp (OSCTXT *pctxt, OSOCTET *buf_p, int bufsiz) |
| OSOCTET * | xe_getp (OSCTXT *pctxt) |
| void | xe_free (OSCTXT *pctxt) |
| int | xe_expandBuffer (OSCTXT *pctxt, size_t length) |
| int | xe_memcpy (OSCTXT *pctxt, const OSOCTET *object_p, size_t length) |
| int | xe_len (OSCTXT *pctxt, int length) |
| int | xe_derCanonicalSort (OSCTXT *pctxt, OSRTSList *pList) |
| int | xe_TagAndIndefLen (OSCTXT *pctxt, ASN1TAG tag, int length) |
| void | xe_getBufLocDescr (OSCTXT *pctxt, OSUINT32 length, Asn1BufLocDescr *pDescr) |
| int | derEncBitString (OSCTXT *pctxt, const OSOCTET *pvalue, OSUINT32 numbits, ASN1TagType tagging) |
Define Documentation
|
|
This function will encode a variable one of ASN.1 UTF-8 character string type.
|
Function Documentation
|
||||||||||||||||||||
|
This function encodes a BIT STRING value in accordance with the Distinguished Encoding Rules (DER). It adjusts the bit count to remove trailing zero bits and then invokes the BER encode function.
|
|
||||||||||||||||||||
|
This function will encode a variable one of the ASN.1 character string types that are based on a 16-bit character set. This includes the ASN.1 BMP character string type.
|
|
||||||||||||||||||||
|
This function will encode a variable one of the ASN.1 character string types that are based on a 32-bit character set. This includes the ASN.1 Universal character string type.
|
|
||||||||||||||||
|
This function encodes a variable of the ASN.1 INTEGER type. In this case, the integer is assumed to be of a larger size than can fit in a C or C++ long type (normally 32 or 64 bits). For example, parameters used to calculate security values are typically larger than these sizes. Items of this type are stored in character string constant variables. They can be represented as decimal strings (with no prefixes), as hexadecimal strings starting with a "0x" prefix, as octal strings starting with a "0o" prefix or as binary strings starting with a "0b" prefix. Other radixes currently are not supported. It is highly recommended to use the hexadecimal or binary strings for better performance.
|
|
||||||||||||||||||||
|
This function will encode a variable of the ASN.1 BIT STRING type.
|
|
||||||||||||||||
|
This function will encode a variable of the ASN.1 BOOLEAN type.
|
|
||||||||||||||||||||
|
This function will encode a variable one of the ASN.1 character string types that are based 8-bit character sets. This includes IA5String, VisibleString, PrintableString, and NumericString
|
|
||||||||||||
|
This function is added to the generated code for SEQUENCE OF/SET OF constructs to ensure the elements are in the required canonical order for DER. If the elements are not in the right order, they are sorted to be in the correct order prior to encoding.
|
|
||||||||||||||||
|
This function will encode a number from character string to ASN.1 real type with using CER/DER decimal encoding. Number may be represented in integer, decimal, and exponent formats.
|
|
||||||||||||||||
|
This function encodes a variable of the ASN.1 ENUMERATED type.
|
|
||||||||||||
|
This function will expand a dynamic encode buffer. The dynamic encode buffer is the buffer that is allocated if dynamic encoding of a message is enabled (passing NULL as the buffer pointer argument to xe_setp enables dynamic encoding.) The size of the new buffer is determined by the length argument. If the length is less than a configurable buffer expansion increment size (the constant ASN_K_ENCBUFSIZ), the buffer is expanded by the increment size; otherwise it is expanded by the actual length value.
|
|
|
This function will free a dynamic encode buffer. The dynamic encode buffer is the buffer that is allocated if dynamic encoding of a message is enabled (passing NULL as the buffer pointer argument to xe_setp enables dynamic encoding.) Note that this is different than the xu_freeall function associated with freeing decoder memory. This function only releases the memory associated with a dynamic encoded buffer. The xu_freeall will not release this memory.
|
|
||||||||||||||||
|
|
|
|
This function is used to obtain a pointer to the start of an encoded message after calls to the encode function(s) are complete. ANS.1 messages are encoded from the end of a given buffer toward the beginning. Therefore, in practically all cases, the start of the message will not be at the beginning of the buffer.
|
|
||||||||||||||||
|
This function encodes a 16-bit variable of the ASN.1 INTEGER type.
|
|
||||||||||||||||
|
This function encodes a 64-bit variable of the ASN.1 INTEGER type.
|
|
||||||||||||||||
|
This function encodes an 8-bit variable of the ASN.1 INTEGER type.
|
|
||||||||||||||||
|
This function encodes a variable of the ASN.1 INTEGER type.
|
|
||||||||||||
|
This function is used to encode BER or DER length determinant values.
|
|
||||||||||||||||
|
This function is used to copy bytes into the encode buffer. BER and DER messages are encoded from back-to-front and this function will take this into account when copying bytes. It will also check to ensure that enough space is available in the buffer for the bytes to be copied. If the encode buffer is dynamic, it will be expanded to hold the number of bytes to be copied if not enough space is available. If the buffer is static and enough space is not available, an error (RTERR_BUFOVFLW) will be returned.
|
|
||||||||||||
|
This function will encode an ASN.1 NULL placeholder.
|
|
||||||||||||||||
|
This function encodes a value of the ASN.1 object identifier type.
|
|
||||||||||||||||||||
|
This function will encode a variable of the ASN.1 OCTET STRING type.
|
|
||||||||||||||||
|
This function encodes a value of the ASN.1 object identifier type, using 64-bit subidentifiers.
|
|
||||||||||||||||
|
This function will encode a variable of the old (pre- 1994) ASN.1 ANY type or other elements defined in the later standards to be Open Types (for example, a variable type declaration in a CLASS construct as defined in X.681). A variable of this type is considered to be previously encoded ASN.1 message component.
|
|
||||||||||||
|
|
|
||||||||||||||||
|
This function will encode a variable of the REAL data type. This function provides support for the plus-infinity and minus-infinity special real values. Use the rtxGetPlusInfinity or rtxGetMinusInfinity functions to get these special values.
|
|
||||||||||||||||
|
This function will encode a number from character string to ASN.1 real type using decimal encoding. Number may be represented in integer, decimal, and exponent formats.
|
|
||||||||||||||||
|
This function encodes a value of the ASN.1 RELATIVE-OID type.
|
|
||||||||||||||||
|
This function is used to set the internal buffer within the runtime library encoding context. It must be called after the context variable is initialized by the rtxInitContext function and before any other compiler generated or runtime library encode function.
|
|
||||||||||||||||
|
This function is used to encode ASN.1 tag and length fields that preface each block of message data. The ANS1C complier generates calls to this function to handle teh encoding of user-defined tags within an ASN.1 specification. The function is also called from within the runtime library functions to handle the addition of the universal tags defined for each of the ASN.1 primitive data types.
|
|
||||||||||||||||
|
This function is used to encode a tag value and an indefinite length. This can be used to manually create an indefinite length wrapper around long records.
|
|
||||||||||||||||
|
This function encodes an unsigned 16-bit variable of the ASN.1 INTEGER type.
|
|
||||||||||||||||
|
This function encodes an unsigned 64-bit variable of the ASN.1 INTEGER type.
|
|
||||||||||||||||
|
This function encodes an unsigned 8-bit variable of the ASN.1 INTEGER type.
|
|
||||||||||||||||
|
This function encodes an unsigned variable of the ASN.1 INTEGER type.
|
