RSA Security logo

RSA BSAFE Cert-C
API Reference

asn1pub.h

Go to the documentation of this file.
00001 /*
00002 * Copyright (c) RSA Security Inc., 1999-2003.  All rights reserved.
00003 * This work contains proprietary, confidential, and trade secret
00004 * information of RSA Security Inc.  Use, disclosure or reproduction
00005 * without the express written authorization of RSA Security Inc. is
00006 * prohibited.
00007 */
00008 
00009 #ifndef HEADER_BSAFE_CERTC_ASN1PUB
00010 #define HEADER_BSAFE_CERTC_ASN1PUB 1
00011 
00073 #include "basetype.h"
00074 #include "certlist.h"
00075 
00076 #ifdef __cplusplus
00077 extern "C" {
00078 #endif
00079 
00080 /* "VT_"  for ASN.1 value tag.
00081    "VTC_" for ASN.1 value tag class.
00082  */
00083 /* basic value tag classes */
00084 #define VTC_UNIVERSAL       0
00085 #define VTC_APPLICATION     0x40
00086 #define VTC_CONTEXT         0x80
00087 #define VTC_PRIVATE         0xC0
00088 
00089 /* value tag class flags */
00090 #define VTC_CONSTRUCTED     0x20
00091 #define VTC_SET             0x100
00092 #define VTC_INDEFINITE_LEN  0x200
00093 
00094 /* value tags.
00095  */
00096 #define VT_BOOLEAN            1
00097 #define VT_INTEGER            2
00098 #define VT_BIT_STRING         3
00099 #define VT_OCTET_STRING       4
00100 #define VT_ASN_NULL           5
00101 #define VT_OBJECT_IDENTIFIER  6
00102 #define VT_OBJECT_DESCRIPTOR  7
00103 #define VT_EXTERNAL           8
00104 #define VT_INSTANCE_OF        8
00105 #define VT_REAL               9
00106 #define VT_ENUMERATED         10
00107 #define VT_EMBEDDED_PDV       11
00108 #define VT_UTF8_STRING        12
00109 #define VT_SEQUENCE           16
00110 #define VT_SET                17
00111 #define VT_NUMERIC_STRING     18
00112 #define VT_PRINTABLE_STRING   19
00113 #define VT_T61_STRING         20
00114 #define VT_TELETEX_STRING     20
00115 #define VT_VIDEOTEX_STRING    21
00116 #define VT_IA5_STRING         22
00117 #define VT_UTC_TIME           23
00118 #define VT_GENERALIZED_TIME   24
00119 #define VT_GRAPHIC_STRING     25
00120 #define VT_ISO646_STRING      26
00121 #define VT_VISIBLE_STRING     26
00122 #define VT_GENERAL_STRING     27
00123 #define VT_UNIVERSAL_STRING   28
00124 #define VT_CHARACTER_STRING   29
00125 #define VT_BMP_STRING         30
00126 
00216 int C_DEREncodeTagAndValue (
00217   CERTC_CTX         ctx,                /* Cert-C context */
00218   int               tag,                /* ASN.1 tag */
00219   unsigned int      tagClass,           /* ASN.1 tag class */
00220   unsigned char     *value,             /* value to be encoded */
00221   unsigned int      len,                /* length of value */
00222   unsigned int      maxOutputLen,       /* len of pre-allocated outputDER */
00223   unsigned char     *outputDER,         /* (in/out) encoded value */
00224   unsigned int      *outputLen);        /* (out) len of encoded value */
00225 
00261 int C_BERDecodeTagAndValue (
00262   CERTC_CTX         ctx,                /* Cert-C context */
00263   unsigned char     *inputBER,          /* BER encoded object */
00264   unsigned int      inputLen,           /* len of inputBER */
00265   int               *tag,               /* (out) returned ASN.1 tag */
00266   unsigned int      *tagClass,          /* (out) returned ASN.1 tag class */
00267   unsigned char     **value,            /* (out) pointer into inputBER */
00268   unsigned int      *len);              /* (out) len of value */
00269 
00295 int C_DEREncodeNull (
00296   CERTC_CTX         ctx,                /* Cert-C context */
00297   int               tag,                /* ASN.1 tag */
00298   unsigned int      tagClass,           /* ASN.1 tag class */
00299   unsigned char     **outputDER,        /* (out) alloc-ed, encoded value */
00300   unsigned int      *outputLen);        /* (out) len of encoded value */
00301 
00326 int C_BERDecodeNull (
00327   CERTC_CTX         ctx,                /* Cert-C context */
00328   unsigned char     *inputBER,          /* encoded NULL */
00329   unsigned int      inputLen,           /* length of encoded NULL */
00330   int               *tag,               /* (out) ASN.1 tag */
00331   unsigned int      *tagClass);         /* (out) ASN.1 tag class */
00332 
00369 int C_DEREncodeInt (
00370   CERTC_CTX         ctx,                /* Cert-C context */
00371   int               tag,                /* ASN.1 tag */
00372   unsigned int      tagClass,           /* ASN.1 tag class */
00373   int               value,              /* integer to be encoded */
00374   unsigned char     **outputDER,        /* (out) alloc-ed, encoded value */
00375   unsigned int      *outputLen);        /* (out) len of encoded value */
00376 
00412 int C_BERDecodeInt (
00413   CERTC_CTX         ctx,                /* Cert-C context */
00414   unsigned char     *inputBER,          /* encoded integer */
00415   unsigned int      inputLen,           /* length of encoded integer */
00416   int               *tag,               /* (out) ASN.1 tag */
00417   unsigned int      *tagClass,          /* (out) ASN.1 tag class */
00418   int               *value);            /* (out) integer value */
00419 
00451 int C_DEREncodeString (
00452   CERTC_CTX         ctx,                /* Cert-C context */
00453   int               tag,                /* ASN.1 tag */
00454   unsigned int      tagClass,           /* ASN.1 tag class */
00455   unsigned char     *value,             /* string to be encoded */
00456   unsigned int      len,                /* length of  string to be encoded */
00457   unsigned char     **outputDER,        /* (out) encoded value */
00458   unsigned int      *outputLen);        /* (out) len of encoded value */
00459 
00522 int C_BERDecodeString (
00523   CERTC_CTX         ctx,                /* Cert-C context */
00524   unsigned char     *inputBER,          /* encoded string */
00525   unsigned int      inputLen,           /* length of encoded string */
00526   int               *tag,               /* (out) ASN.1 tag */
00527   unsigned int      *tagClass,          /* (out) ASN.1 tag class */
00528   unsigned char     **value,            /* (out) alloc-ed string */
00529   unsigned int      *len);              /* (out) len of string */
00530 
00558 int C_DEREncodeGeneralizedTime (
00559   CERTC_CTX         ctx,                /* Cert-C context */
00560   int               tag,                /* ASN.1 tag */
00561   unsigned int      tagClass,           /* ASN.1 tag class */
00562   GENERALIZED_TIME  *value,             /* time to be encoded */
00563   unsigned char     **outputDER,        /* (out) alloc-ed, encoded value */
00564   unsigned int      *outputLen);        /* (out) len of encoded value */
00565 
00593 int C_BERDecodeGeneralizedTime (
00594   CERTC_CTX         ctx,                /* Cert-C context */
00595   unsigned char     *inputBER,          /* encoded time */
00596   unsigned int      inputLen,           /* length of encoded time */
00597   int               *tag,               /* (out) ASN.1 tag */
00598   unsigned int      *tagClass,          /* (out) ASN.1 tag class */
00599   GENERALIZED_TIME  *value);            /* (out) time value */
00600 
00636 int C_DEREncodeUTCTime (
00637   CERTC_CTX         ctx,                /* Cert-C context */
00638   int               tag,                /* ASN.1 tag */
00639   unsigned int      tagClass,           /* ASN.1 tag class */
00640   UINT4             value,              /* time to be encoded */
00641   unsigned char     **outputDER,        /* (out) alloc-ed, encoded value */
00642   unsigned int      *outputLen);        /* (out) len of encoded value */
00643 
00678 int C_BERDecodeUTCTime (
00679   CERTC_CTX         ctx,                /* Cert-C context */
00680   unsigned char     *inputBER,          /* encoded time */
00681   unsigned int      inputLen,           /* length of encoded time */
00682   int               *tag,               /* (out) ASN.1 tag */
00683   unsigned int      *tagClass,          /* (out) ASN.1 tag class */
00684   UINT4             *value);            /* (out) time value */
00685 
00719 int C_DEREncodeBitString (
00720   CERTC_CTX         ctx,                /* Cert-C context */
00721   int               tag,                /* ASN.1 tag */
00722   unsigned int      tagClass,           /* ASN.1 tag class */
00723   BIT_STRING        *value,             /* bit string to be encoded */
00724   unsigned char     **outputDER,        /* (out) alloc-ed, encoded value */
00725   unsigned int      *outputLen);        /* (out) len of encoded value */
00726 
00762 int C_DEREncodeNamedBitString (
00763   CERTC_CTX         ctx,                /* Cert-C context */
00764   int               tag,                /* ASN.1 tag */
00765   unsigned int      tagClass,           /* ASN.1 tag class */
00766   BIT_STRING        *value,             /* bit string to be encoded */
00767   unsigned char     **outputDER,        /* (out) alloc-ed, encoded value */
00768   unsigned int      *outputLen);        /* (out) len of encoded value */
00769 
00799 int C_BERDecodeBitString (
00800   CERTC_CTX         ctx,                /* Cert-C context */
00801   unsigned char     *inputBER,          /* encoded bit string */
00802   unsigned int      inputLen,           /* length of encoded bit string */
00803   int               *tag,               /* (out) ASN.1 tag */
00804   unsigned int      *tagClass,          /* (out) ASN.1 tag class */
00805   BIT_STRING        *value);            /* (out) bit string value */
00806 
00911 int C_DEREncodeList (
00912   CERTC_CTX         ctx,                /* Cert-C context */
00913   int               tag,                /* ASN.1 tag */
00914   unsigned int      tagClass,           /* ASN.1 tag class */
00915   LIST_OBJ          list,               /* list of ITEM pointers */
00916   unsigned char     **outputDER,        /* (out) encoded value */
00917   unsigned int      *outputLen);        /* (out) len of encoded value */
00918 
00964 int C_BERDecodeList (
00965   CERTC_CTX         ctx,                /* Cert-C context */
00966   unsigned char     *inputBER,          /* encoded value */
00967   unsigned int      inputLen,           /* length of encoded value */
00968   int               *tag,               /* (out) ASN.1 tag */
00969   unsigned int      *tagClass,          /* (out) ASN.1 tag class */
00970   LIST_OBJ          list);              /* (in/out) list of ITEM pointers */
00971 
00972 #ifdef __cplusplus
00973 }
00974 #endif
00975 
00976 #endif /* HEADER_BSAFE_CERTC_ASN1PUB */



RSA BSAFE® Cert-C 2.7 API Reference