RSA Security logo

RSA BSAFE Cert-C
API Reference

asn1pub.h File Reference

This file provides functions to encode or decode selected ASN.1 types.

The following table lists the ASN.1 types and the tag constants.


  ASN.1 Type        Tag Constant
  ------------------------------------

  BOOLEAN           VT_BOOLEAN
  INTEGER           VT_INTEGER
  BIT STRING        VT_BIT_STRING
  OCTET STRING      VT_OCTET_STRING
  NULL              VT_ASN_NULL
  OBJECT IDENTIFIER VT_OBJECT_IDENTIFIER
  OBJECT DESCRIPTOR VT_OBJECT_DESCRIPTOR
  EXTERNAL          VT_EXTERNAL
  INSTANCE OF       VT_INSTANCE_OF
  REAL              VT_REAL
  ENUMERATED        VT_ENUMERATED
  EMBEDDED PDV      VT_EMBEDDED_PDV
  UTF8 STRING       VT_UTF8_STRING
  SEQUENCE          VT_SEQUENCE
  SET               VT_SET
  NUMERIC STRING    VT_NUMERIC_STRING
  PRINTABLE STRING  VT_PRINTABLE_STRING
  T61 STRING        VT_T61_STRING
  TELETEX STRING    VT_TELETEX_STRING
  VIDEOTEX STRING   VT_VIDEOTEX_STRING
  IA5 STRING        VT_IA5_STRING
  UTC TIME          VT_UTC_TIME
  GENERALIZED TIME  VT_GENERALIZED_TIME
  GRAPHIC STRING    VT_GRAPHIC_STRING
  ISO646 STRING     VT_ISO646_STRING
  VISIBLE STRING    VT_VISIBLE_STRING
  GENERAL STRING    VT_GENERAL_STRING
  UNIVERSAL STRING  VT_UNIVERSAL_STRING
  CHARACTER STRING  VT_CHARACTER_STRING
  BMP STRING        VT_BMP_STRING
 

The following value tag classes are defined in this header.

      VTC_UNIVERSAL 
      VTC_APPLICATION
      VTC_CONTEXT 
      VTC_PRIVATE 
 

The following value tag class flags are defined in this header.

      VTC_CONSTRUCTED 
      VTC_SET
      VTC_INDEFINITE_LEN
 

#include "basetype.h"
#include "certlist.h"

Go to the source code of this file.

Functions

int C_DEREncodeTagAndValue (CERTC_CTX ctx, int tag, unsigned int tagClass, unsigned char *value, unsigned int len, unsigned int maxOutputLen, unsigned char *outputDER, unsigned int *outputLen)
 Encodes an encoded value's prefix, and, optionally, copies the value encoding. More...

int C_BERDecodeTagAndValue (CERTC_CTX ctx, unsigned char *inputBER, unsigned int inputLen, int *tag, unsigned int *tagClass, unsigned char **value, unsigned int *len)
 Decodes any ASN.1 encoded data. More...

int C_DEREncodeNull (CERTC_CTX ctx, int tag, unsigned int tagClass, unsigned char **outputDER, unsigned int *outputLen)
 DER encodes an ASN.1 NULL value. More...

int C_BERDecodeNull (CERTC_CTX ctx, unsigned char *inputBER, unsigned int inputLen, int *tag, unsigned int *tagClass)
 Decodes a BER-encoded ASN.1 NULL value. More...

int C_DEREncodeInt (CERTC_CTX ctx, int tag, unsigned int tagClass, int value, unsigned char **outputDER, unsigned int *outputLen)
 DER encodes an integer. More...

int C_BERDecodeInt (CERTC_CTX ctx, unsigned char *inputBER, unsigned int inputLen, int *tag, unsigned int *tagClass, int *value)
 Decodes a BER-encoded integer. More...

int C_DEREncodeString (CERTC_CTX ctx, int tag, unsigned int tagClass, unsigned char *value, unsigned int len, unsigned char **outputDER, unsigned int *outputLen)
 DER encodes a character-string or octet-string value. More...

int C_BERDecodeString (CERTC_CTX ctx, unsigned char *inputBER, unsigned int inputLen, int *tag, unsigned int *tagClass, unsigned char **value, unsigned int *len)
 Decodes a BER-encoded character string or octet string. More...

int C_DEREncodeGeneralizedTime (CERTC_CTX ctx, int tag, unsigned int tagClass, GENERALIZED_TIME *value, unsigned char **outputDER, unsigned int *outputLen)
 DER encodes a GENERALIZED_TIME value. More...

int C_BERDecodeGeneralizedTime (CERTC_CTX ctx, unsigned char *inputBER, unsigned int inputLen, int *tag, unsigned int *tagClass, GENERALIZED_TIME *value)
 Decodes a BER-encoded GENERALIZED_TIME value. More...

int C_DEREncodeUTCTime (CERTC_CTX ctx, int tag, unsigned int tagClass, UINT4 value, unsigned char **outputDER, unsigned int *outputLen)
 DER encodes a time value using the UTC Time encoding syntax. More...

int C_BERDecodeUTCTime (CERTC_CTX ctx, unsigned char *inputBER, unsigned int inputLen, int *tag, unsigned int *tagClass, UINT4 *value)
 Decodes a BER-encoded UTC Time value. More...

int C_DEREncodeBitString (CERTC_CTX ctx, int tag, unsigned int tagClass, BIT_STRING *value, unsigned char **outputDER, unsigned int *outputLen)
 DER encodes a BIT_STRING value. More...

int C_DEREncodeNamedBitString (CERTC_CTX ctx, int tag, unsigned int tagClass, BIT_STRING *value, unsigned char **outputDER, unsigned int *outputLen)
 DER encodes a BIT_STRING value. More...

int C_BERDecodeBitString (CERTC_CTX ctx, unsigned char *inputBER, unsigned int inputLen, int *tag, unsigned int *tagClass, BIT_STRING *value)
 Decodes a BER-encoded BIT_STRING value. More...

int C_DEREncodeList (CERTC_CTX ctx, int tag, unsigned int tagClass, LIST_OBJ list, unsigned char **outputDER, unsigned int *outputLen)
 DER encodes a list of DER-encoded values, represented by a LIST_OBJ containing ITEM entries. More...

int C_BERDecodeList (CERTC_CTX ctx, unsigned char *inputBER, unsigned int inputLen, int *tag, unsigned int *tagClass, LIST_OBJ list)
 Decodes a BER-encoded constructed value. More...


Function Documentation

int C_BERDecodeBitString CERTC_CTX    ctx,
unsigned char *    inputBER,
unsigned int    inputLen,
int *    tag,
unsigned int *    tagClass,
BIT_STRING   value
;
 

Decodes a BER-encoded BIT_STRING value. The application must (eventually) free the buffer returned in the value.data field by calling T_free.

Parameters:
ctx This input parameter is the Cert-C context.
inputBER This input parameter points to the BER-encoded BIT_STRING value.
inputLen This input parameter is the length, in bytes, of the BER-encoded value.
tag This output parameter points to the ASN.1 data-type tag for the returned value.
tagClass This output parameter points to the ASN.1 value-tag class for the returned value.
value This output parameter is the decoded BIT_STRING value.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_BERDecodeGeneralizedTime CERTC_CTX    ctx,
unsigned char *    inputBER,
unsigned int    inputLen,
int *    tag,
unsigned int *    tagClass,
GENERALIZED_TIME   value
;
 

Decodes a BER-encoded GENERALIZED_TIME value.

Parameters:
ctx This input parameter is the Cert-C context.
inputBER This input parameter points to the BER-encoded GENERALIZED_TIME value.
inputLen This input parameter is the length, in bytes, of the BER-encoded value.
tag This output parameter points to the ASN.1 data-type tag for the returned value.
tagClass This output parameter points to the ASN.1 value-tag class for the returned value.
value This output parameter is the decoded GENERALIZED_TIME value.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_BERDecodeInt CERTC_CTX    ctx,
unsigned char *    inputBER,
unsigned int    inputLen,
int *    tag,
unsigned int *    tagClass,
int *    value
;
 

Decodes a BER-encoded integer. The application can also use this function to decode BOOLEAN and ENUMERATED values. For BOOLEAN values, the function returns 0 (zero) for FALSE, or -1 (negative one) for TRUE in the value field. For ENUMERATED values, the function returns the numeric value corresponding to the enumeration item identifier.

Parameters:
ctx This input parameter is the Cert-C context.
inputBER This input parameter points to the BER-encoded integer value.
inputLen This input parameter is the length, in bytes, of the encoded integer value.
tag This output parameter points to the ASN.1 data-type tag for the returned value.
tagClass This output parameter points to the ASN.1 value-tag class for the returned value.
value This output parameter points to the returned decoded integer value.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_BERDecodeList CERTC_CTX    ctx,
unsigned char *    inputBER,
unsigned int    inputLen,
int *    tag,
unsigned int *    tagClass,
LIST_OBJ    list
;
 

Decodes a BER-encoded constructed value. The list parameter is a LIST_OBJ. This function adds entries to the list corresponding to each component of the constructed value. Each entry added to the LIST_OBJ points to an ITEM. The ITEM specifies the length of the BER-encoded component value, and points to that value. If you want to further decode the components of the value, the application can iterate through the list entries and call the appropriate C_BERDecode*() functions. The application can use this function to decode SET, SET OF, SEQUENCE, and SEQUENCE OF types. This function can also be used to decode EXPLICIT tagged types.

Parameters:
ctx This input parameter is the Cert-C context.
inputBER This input parameter points to the encoded value.
inputLen This input parameter is the length, in bytes, of the encoding.
tag This output parameter points to the ASN.1 data-type tag for the returned list.
tagClass This output parameter points to the ASN.1 value-tag class for the returned list.
list This input/output parameter points to the returned decoded list value. The LIST_OBJ is a list of ITEM pointers.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_BERDecodeNull CERTC_CTX    ctx,
unsigned char *    inputBER,
unsigned int    inputLen,
int *    tag,
unsigned int *    tagClass
;
 

Decodes a BER-encoded ASN.1 NULL value.

Parameters:
ctx This input parameter is the Cert-C context.
inputBER This input parameter points to the BER-encoded ASN.1 NULL value to decode.
inputLen This input parameter is the length, in bytes, of the inputBER.
tag This output parameter points to the ASN.1 data-type tag for the returned value.
tagClass This output parameter points to the ASN.1 value-tag class for the returned value.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_BERDecodeString CERTC_CTX    ctx,
unsigned char *    inputBER,
unsigned int    inputLen,
int *    tag,
unsigned int *    tagClass,
unsigned char **    value,
unsigned int *    len
;
 

Decodes a BER-encoded character string or octet string. The ASN.1 BER specify that strings can be encoded in one of two ways.

  • In the first variation, the entire string is encoded as a nonconstructed, primitive value.
  • In the second variation, the string is divided into BER-encoded substrings and the whole string is encoded as a constructed sequence of these substrings.
The C_BERDecodeString() function adaptively decodes both variations based on the CONSTRUCTED flag in the encoded tag. Constructed encodings have two variations for the representation of the value length: a definite-length encoding and an indefinite-length encoding. Again, this function handles both variations. You can use this function in one of two ways:
  • If you pass in a NULL value pointer, then len is set on return to the number of bytes in the decoded string.
  • If you pass in a non-NULL value pointer, then the function allocates storage for the decoded string, stores it in the location pointed to by value, and returns the length of the string in len.
In the second case, the application is responsible for (eventually) freeing the buffer returned in value by calling T_free.
Parameters:
ctx This input parameter is the Cert-C context.
inputBER This input parameter is the BER-encoded character or octet string to decode.
inputLen This input parameter is the number of bytes in inputBER.
tag This output parameter points to the ASN.1 data-type tag for the returned value.
tagClass This output parameter points to the ASN.1 value-tag class for the returned value.
value This output parameter returns a pointer to a dynamically allocated copy of the decoded string, if the value passed in is not NULL.
len This output parameter returns the length, in bytes, of the decoded string.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_BERDecodeTagAndValue CERTC_CTX    ctx,
unsigned char *    inputBER,
unsigned int    inputLen,
int *    tag,
unsigned int *    tagClass,
unsigned char **    value,
unsigned int *    len
;
 

Decodes any ASN.1 encoded data. It decodes the tag and length, and returns a pointer to the encoded value.

Parameters:
ctx This input parameter is the Cert-C context.
inputBER This input parameter points to a buffer that contains BER-encoded data.
inputLen This input parameter is the length of inputBER in bytes.
tag This output parameter points to the ASN.1 data-type tag for the returned value.
tagClass This output parameter points to the ASN.1 value-tag class for the returned value. The VTC_SET flag is not to be set.
value This output parameter points to the first byte of the encoded value that follows the tag and length prefix. This value should not be freed by the caller as it is only a pointer into the inputBER buffer.
len This output parameter points to the length, in bytes, of the returned encoded value.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_BERDecodeUTCTime CERTC_CTX    ctx,
unsigned char *    inputBER,
unsigned int    inputLen,
int *    tag,
unsigned int *    tagClass,
UINT4 *    value
;
 

Decodes a BER-encoded UTC Time value. It returns a value that indicates the number of seconds since 12:00 A.M. GMT, January 1, 1970. The UTC Time encoding rules specify that the year is encoded using two decimal digits. Cert-C decodes years 00-49 as the years 2000-2049. Cert-C interprets encoded years 70-99 as the years 1970-1999. Cert-C returns an error for encoded years 50-69.

Parameters:
ctx This input parameter is the Cert-C context.
inputBER This input parameter points to the BER-encoded UTC Time value.
inputLen This input parameter is the length, in bytes, of the BER-encoded value.
tag This output parameter points to the ASN.1 data-type tag for the returned value.
tagClass This output parameter points to the ASN.1 value-tag class for the returned value.
value This output parameter is the decoded UTC Time value.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_DEREncodeBitString CERTC_CTX    ctx,
int    tag,
unsigned int    tagClass,
BIT_STRING   value,
unsigned char **    outputDER,
unsigned int *    outputLen
;
 

DER encodes a BIT_STRING value. The application calls T_free to free the buffer returned in outputDER. The application should use this function to encode a bit string when the ASN.1 source does not specifically enumerate and name the bits of the bit string. If the bits are named, the C_DEREncodeNamedBitString() function should be called instead.

Parameters:
ctx This input parameter is the Cert-C context.
tag This input parameter is the ASN.1 data-type tag for value.
tagClass This input parameter is the ASN.1 value-tag class for value.
value This input parameter points to the BIT_STRING value to DER encode.
outputDER This output parameter points to the location of the dynamically allocated output buffer.
outputLen This output parameter is the length, in bytes, of the encoding.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_DEREncodeGeneralizedTime CERTC_CTX    ctx,
int    tag,
unsigned int    tagClass,
GENERALIZED_TIME   value,
unsigned char **    outputDER,
unsigned int *    outputLen
;
 

DER encodes a GENERALIZED_TIME value. The application calls T_free to free the buffer returned in outputDER.

Parameters:
ctx This input parameter is the Cert-C context.
tag This input parameter is the ASN.1 data-type tag for value.
tagClass This input parameter is the ASN.1 value-tag class for value.
value This input parameter points to the GENERALIZED_TIME value to encode.
outputDER This output parameter points to where the dynamically allocated output buffer is returned.
outputLen This output parameter is the length, in bytes, of the encoded value.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_DEREncodeInt CERTC_CTX    ctx,
int    tag,
unsigned int    tagClass,
int    value,
unsigned char **    outputDER,
unsigned int *    outputLen
;
 

DER encodes an integer. The application can also use this function to encode BOOLEAN and ENUMERATED values. For BOOLEAN values, the application should pass in a value of 0 (zero) for FALSE, or -1 (negative one) for TRUE. For ENUMERATED values, the application should pass in the numeric value that corresponds to the enumeration item identifier. The application calls T_free to free the buffer returned in outputDER.

Parameters:
ctx This input parameter is the Cert-C context.
tag This input parameter is the ASN.1 data-type tag for value.
tagClass This input parameter is the ASN.1 value-tag class for value.
value This input parameter is the integer to DER encode.
outputDER This output parameter points to where a dynamically allocated output buffer is returned.
outputLen This output parameter is the length, in bytes, of the encoded value.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_DEREncodeList CERTC_CTX    ctx,
int    tag,
unsigned int    tagClass,
LIST_OBJ    list,
unsigned char **    outputDER,
unsigned int *    outputLen
;
 

DER encodes a list of DER-encoded values, represented by a LIST_OBJ containing ITEM entries. Each entry in the LIST_OBJ points to an ITEM. The ITEM specifies the length of the DER-encoded value and points to that value. The application calls T_free to free the buffer returned in outputDER.

The application can use this function to DER encode SET, SET OF, SEQUENCE, and SEQUENCE OF types. It can also use this function to DER encode EXPLICIT types. The following list explains how to implement this function for each of these ASN.1 data types:

  • To encode a SET type, the application should add the DER-encoded elements of the SET to the list. The application is responsible for ensuring that each type in the set occurs at most once. (Optional elements may be omitted.) The application can specify the VT_SET tag with the VTC_UNIVERSAL tag class, or specify a custom tag with another tag class. If the tag class is not VTC_UNIVERSAL, the application should set the VTC_SET and VTC_CONSTRUCTED flags in the tag class parameter.
  • To encode a SET OF type, the application should add the DER-encoded elements of the SET OF to the list. The application is responsible for ensuring that the encoded element types are the same. The application can specify the VT_SET tag with the VTC_UNIVERSAL tag class, or specify a custom tag with another tag class. If the tag class is not VTC_UNIVERSAL, the application should set the VTC_SET and VTC_CONSTRUCTED flags in the tag class parameter.
  • To encode a SEQUENCE type, the application should add the DER-encoded elements of the SEQUENCE to the list in the desired order. The application can specify the VT_SEQUENCE tag with the VTC_UNIVERSAL tag class, or specify a custom tag with another tag class. If the tag class is not VTC_UNIVERSAL, the application should set the VTC_CONSTRUCTED flag in the tag class parameter.
  • To encode a SEQUENCE OF type, the application should add the DER-encoded elements of the SEQUENCE OF to the list in the desired order. The application can specify the VT_SEQUENCE tag with the VTC_UNIVERSAL tag class, or specify a custom tag with another tag class. If the tag class is not VTC_UNIVERSAL, the application should set the VTC_CONSTRUCTED flag in the tag class parameter.
  • To encode an EXPLICIT tagged type, the application should first DER encode the value using the base tag. The application should then create a LIST_OBJ and add the encoded value as the single entry in the list. The application can then call C_DEREncodeList() with the custom tag. The application should set the VTC_CONSTRUCTED flag in the tag class parameter.
Parameters:
ctx This input parameter is the Cert-C context.
tag This input parameter is the ASN.1 data-type tag for list.
tagClass This input parameter is the ASN.1 value-tag class for list.
list This input parameter is the list of DER-encoded ITEMs.
outputDER This output parameter points to where the dynamically allocated output buffer is returned.
outputLen This output parameter is the length, in bytes, of the encoding.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_DEREncodeNamedBitString CERTC_CTX    ctx,
int    tag,
unsigned int    tagClass,
BIT_STRING   value,
unsigned char **    outputDER,
unsigned int *    outputLen
;
 

DER encodes a BIT_STRING value. The application calls T_free to free the buffer returned in outputDER. The application should use this function to encode a bit string when the ASN.1 source specifically enumerates and names the bits of the bit string. If the bits are not named, the C_DEREncodedBitString() function should be called instead. (C_DEREncodeNamedBitString() strips trailing zero bits before encoding.)

Parameters:
ctx This input parameter is the Cert-C context.
tag This input parameter is the ASN.1 data-type tag for value.
tagClass This input parameter is the ASN.1 value-tag class for value.
value This input parameter is the BIT_STRING value to DER encode.
outputDER This output parameter points to where the dynamically allocated output buffer is returned.
outputLen This output parameter is the length, in bytes, of the encoding.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_DEREncodeNull CERTC_CTX    ctx,
int    tag,
unsigned int    tagClass,
unsigned char **    outputDER,
unsigned int *    outputLen
;
 

DER encodes an ASN.1 NULL value. The application calls T_free to free the buffer returned in outputDER.

Parameters:
ctx This input parameter is the Cert-C context.
tag This input parameter is the ASN.1 data-type tag for the value to DER encode.
tagClass This input parameter is the ASN.1 value-tag class for the value to DER encode.
outputDER This output parameter points to the location where the dynamically allocated output buffer is returned.
outputLen This output parameter is the number of bytes used in outputDER.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_DEREncodeString CERTC_CTX    ctx,
int    tag,
unsigned int    tagClass,
unsigned char *    value,
unsigned int    len,
unsigned char **    outputDER,
unsigned int *    outputLen
;
 

DER encodes a character-string or octet-string value. The application calls T_free to free the buffer returned in outputDER.

Parameters:
ctx This input parameter is the Cert-C context.
tag This input parameter is the ASN.1 data-type tag for value.
tagClass This input parameter is the ASN.1 value-tag class for value.
value This input parameter is the character or octet string to DER encode.
len This input parameter is the length of the value in bytes.
outputDER This output parameter points to the allocated memory where the DER-encoded value is stored.
outputLen This output parameter is the number of bytes used in outputDER.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_DEREncodeTagAndValue CERTC_CTX    ctx,
int    tag,
unsigned int    tagClass,
unsigned char *    value,
unsigned int    len,
unsigned int    maxOutputLen,
unsigned char *    outputDER,
unsigned int *    outputLen
;
 

Encodes an encoded value's prefix, and, optionally, copies the value encoding. A value that is encoded according to the ASN.1 DER consists of two parts: a prefix that contains a data-type tag and a value length; and the value encoding itself. This function assumes that the value itself has already been encoded appropriately. It provides support for encoding the prefix and, optionally, copying the value encoding. This function can be used in one of four ways:

  • The function can calculate the encoded length of the tag and value. In this case, value must be non-NULL, and outputDER must be set to NULL_PTR. The maxOutputLen is ignored. On return, outputLen is set to the length of the encoding, including the length of the value.
  • The function can calculate the length of just the encoded tag and length prefix. In this case, both value and outputLen are set to NULL_PTR. (The len should still be set to the length of the value in bytes.) The maxOutputLen is ignored. On return, outputLen is set to the length of the encoded tag and the length of the prefix.
  • The function can encode just the tag and length prefix into a buffer. In this case, value is set to NULL_PTR and outputDER must be non-NULL. (The len should still be set to the length of the value in bytes.) If the size of the encoded tag and length exceeds the value of maxOutputLen, an error is returned. On return, the outputDER buffer contains a copy of the encoded tag and length prefix, and outputLen is set to the length of the prefix.
  • The function can encode the tag and length prefix into a buffer and append a copy of the value into that same buffer. In this case, value and outputDER must be non-NULL. If the size of the encoding exceeds the value of maxOutputLen, an error is returned. On return, the outputDER buffer contains a copy of the encoding and outputLen is set to the length of the entire encoding.
Parameters:
ctx This input parameter is the Cert-C context.
tag This input parameter is the ASN.1 data-type tag for value.
tagClass This input parameter is the ASN.1 value-tag class for value. If the tag class is not VTC_UNIVERSAL (0), and the value is constructed, then the VTC_CONSTRUCTED flag must be set. The other flag values are ignored.
value This input parameter is optional; it points to the value contents to be encoded.
len This input parameter is the length of value in bytes.
maxOutputLen This input parameter is the maximum allowed length of the pre-allocated outputDER.
outputDER This output parameter points to a pre-allocated buffer where the encoding is to be stored.
outputLen This output parameter points to the location where the length of the encoding is to be stored.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_DEREncodeUTCTime CERTC_CTX    ctx,
int    tag,
unsigned int    tagClass,
UINT4    value,
unsigned char **    outputDER,
unsigned int *    outputLen
;
 

DER encodes a time value using the UTC Time encoding syntax. The input value must be specified as the number of seconds since 12:00 A.M. GMT, January 1, 1970. The application can call T_free to free the buffer returned in outputDER. The UTC Time encoding rules specify that the year is to be encoded using two decimal digits. Cert-C encodes years from 1970-1999 as 70-99. Cert-C encodes years from 2000-2049 as 00-49. Cert-C returns an error for encoded years 50-69.

Parameters:
ctx This input parameter is the Cert-C context.
tag This input parameter is the ASN.1 data-type tag for value.
tagClass This input parameter is the ASN.1 value-tag class for value.
value This input parameter is the UTC Time value to DER encode.
outputDER This output parameter points to where the dynamically allocated output buffer is returned.
outputLen This output parameter is the length, in bytes, of the DER-encoded value.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.



RSA BSAFE® Cert-C 2.7 API Reference