RSA Security logo

RSA BSAFE Cert-C
API Reference

certattr.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_CERTATTR
00010 #define HEADER_BSAFE_CERTC_CERTATTR 1
00011 
00017 #include "basetype.h"
00018 #include "asn1pub.h"
00019 
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023 
00024 /* Default name attribute types.
00025  */
00026 extern unsigned char AT_SERIAL_NUMBER[];
00027 extern unsigned char AT_COUNTRY[];
00028 extern unsigned char AT_STATE[];
00029 extern unsigned char AT_LOCALITY[];
00030 extern unsigned char AT_ORGANIZATION[];
00031 extern unsigned char AT_ORG_UNIT[];
00032 extern unsigned char AT_COMMON_NAME[];
00033 extern unsigned char AT_TITLE[];
00034 extern unsigned char AT_STREET_ADDRESS[];
00035 extern unsigned char AT_POSTAL_CODE[];
00036 extern unsigned char AT_EMAIL_ADDRESS[];
00037 extern unsigned char AT_DN_QUALIFIER[];
00038 extern unsigned char AT_SURNAME[];
00039 extern unsigned char AT_GIVEN_NAME[];
00040 extern unsigned char AT_INITIALS[];
00041 extern unsigned char AT_GENERATION_QUALIFIER[];
00042 extern unsigned char AT_DOMAIN_COMPONENT[];
00043 extern unsigned char AT_NAME[];
00044 
00045 /* Default name attribute type lengths.
00046  */
00047 #define AT_SERIAL_NUMBER_LEN 3
00048 #define AT_COUNTRY_LEN 3
00049 #define AT_STATE_LEN 3
00050 #define AT_LOCALITY_LEN 3
00051 #define AT_ORGANIZATION_LEN 3
00052 #define AT_ORG_UNIT_LEN 3
00053 #define AT_COMMON_NAME_LEN 3
00054 #define AT_TITLE_LEN 3
00055 #define AT_STREET_ADDRESS_LEN 3
00056 #define AT_POSTAL_CODE_LEN 3
00057 #define AT_EMAIL_ADDRESS_LEN 9
00058 #define AT_DN_QUALIFIER_LEN 3
00059 #define AT_SURNAME_LEN 3
00060 #define AT_GIVEN_NAME_LEN 3
00061 #define AT_INITIALS_LEN 3
00062 #define AT_GENERATION_QUALIFIER_LEN 3
00063 #define AT_DOMAIN_COMPONENT_LEN 10
00064 #define AT_NAME_LEN 3
00065 
00066 /* RSA X.509 v3 Extensions attribute */
00067 extern unsigned char AT_X509_V3_EXTENSIONS[];
00068 #define AT_X509_V3_EXTENSIONS_LEN 9
00069 
00070 /* Postal address attribute.
00071  */
00072 #define MAX_ADDRESS_LINE_COUNT 6
00073 #define MAX_ADDRESS_LINE_LEN 30
00074 
00098 typedef struct {
00099   unsigned int count;
00100   struct {
00101     int            tag;
00102     unsigned char *value;
00103     unsigned int   valueLen;
00104   } lines[MAX_ADDRESS_LINE_COUNT];
00105 } POSTAL_ADDRESS;
00106 
00107 /* Default name attribute value length limits.
00108  */
00109 #define COUNTRY_LEN 2
00110 #define MAX_SERIAL_NUMBER_LEN 64
00111 #define MAX_STATE_LEN 128
00112 #define MAX_LOCALITY_LEN 128
00113 #define MAX_ORGANIZATION_LEN 64
00114 #define MAX_ORG_UNIT_LEN 64
00115 #define MAX_COMMON_NAME_LEN 64
00116 #define MAX_TITLE_LEN 64
00117 #define MAX_STREET_ADDRESS_LEN 128
00118 #define MAX_POSTAL_CODE_LEN 40
00119 #define MAX_EMAIL_ADDRESS_LEN 128
00120 #define MAX_DOMAIN_COMPONENT_LEN 64
00121 #define MAX_NAME_LEN 32768
00122 
00123 /* Other constants */
00124 #define MAX_DIGEST_LEN 20
00125 
00126 
00127 #define NV_FLAGS_SORTED             0x00000001
00128 #define NV_FLAGS_SUPPRESS_FINAL_SEP 0x00000002
00129 
00150 int C_CreateAttributesObject (
00151   ATTRIBUTES_OBJ *attributesObj); /* (out) attributes object */
00152 
00179 int C_GetAttributesDER (
00180   ATTRIBUTES_OBJ   attributesObj,   /* (in)  attributes object */
00181   unsigned char  **der,             /* (out) encoded attributes */
00182   unsigned int    *derLen);         /* (out) encoded attributes length */
00183 
00208 int C_SetAttributesBER (
00209   ATTRIBUTES_OBJ  attributesObj,   /* (mod) attributes object */
00210   unsigned char  *ber,             /* (in)  encoded attributes */
00211   unsigned int    berLen);         /* (in)  encoded attributes length */
00212 
00227 int C_GetAttributeTypeCount (
00228   ATTRIBUTES_OBJ  attributesObj,   /* (in)  attributes object */
00229   unsigned int   *count);          /* (out) # of distinct attributes */
00230 
00263 int C_GetAttributeType (
00264   ATTRIBUTES_OBJ   attributesObj,   /* (in) attributes object */
00265   unsigned int     index,           /* (in) index of attribute */
00266   unsigned char  **type,            /* (out) attribute type */
00267   unsigned int    *typeLen);        /* (out) attribute type length */
00268 
00292 int C_GetAttributeValueCount (
00293   ATTRIBUTES_OBJ  attributesObj,   /* (in)  attributes object */
00294   unsigned char  *type,            /* (in)  attribute type */
00295   unsigned int    typeLen,         /* (in)  attribute type length */
00296   unsigned int   *count);          /* (out) value count */
00297 
00339 int C_GetAttributeValueDER (
00340   ATTRIBUTES_OBJ   attributesObj,   /* (in)  attributes object */
00341   unsigned char   *type,            /* (in)  attribute type */
00342   unsigned int     typeLen,         /* (in)  attribute type length */
00343   unsigned int     valueIndex,      /* (in)  value index */
00344   unsigned char  **valueDER,        /* (out) encoded value */
00345   unsigned int    *valueDERLen);    /* (out) encoded value length */
00346 
00391 int C_GetStringAttribute (
00392   ATTRIBUTES_OBJ   attributesObj,  /* (in)  attributes object     */
00393   unsigned char   *type,           /* (in)  attribute type        */
00394   unsigned int     typeLen,        /* (in)  attribute type length */
00395   unsigned int     valueIndex,     /* (in)  value index           */
00396   int             *valueTag,       /* (out) value character type  */
00397   unsigned char  **value,          /* (out) value                 */
00398   unsigned int    *valueLen);      /* (out) value length          */
00399 
00420 int C_DeleteAttributeType (
00421   ATTRIBUTES_OBJ  attributesObj,   /* (mod) attributes object     */
00422   unsigned char  *type,            /* (in)  attribute type        */
00423   unsigned int    typeLen);        /* (in)  attribute type length */
00424 
00461 int C_AddAttributeValueBER (
00462   ATTRIBUTES_OBJ   attributesObj,   /* (mod) attributes object        */
00463   unsigned char   *type,            /* (in) attribute type            */
00464   unsigned int     typeLen,         /* (in) attribute type length     */
00465   unsigned char   *value,           /* (in) attribute value           */
00466   unsigned int     valueLen);       /* (in) length of attribute value */
00467 
00510 int C_AddStringAttribute (
00511   ATTRIBUTES_OBJ   attributesObj,   /* (mod) attributes object        */
00512   unsigned char   *type,            /* (in) attribute type            */
00513   unsigned int     typeLen,         /* (in) attribute type length     */
00514   int              valueTag,        /* (in) value character type      */
00515   unsigned char   *value,           /* (in) attribute value           */
00516   unsigned int     valueLen);       /* (in) length of attribute value */
00517 
00556 int C_GetAttributesURLEncoded (
00557   ATTRIBUTES_OBJ   attributesObj,  /* (in)  attributes object        */
00558   unsigned char  **str,            /* (out) url-encoded value        */
00559   unsigned int    *strLen);        /* (out) url-encoded value length */
00560 
00617 int C_GetAttributesNameValueEncoded(
00618   ATTRIBUTES_OBJ   attributesObj,    /* (in)  attributes object                  */
00619   unsigned char   *pInnerSep,        /* (in)  string separating name from value  */
00620   unsigned char   *pOuterSep,        /* (in)  string separating name-value pairs */
00621   unsigned int     flags,            /* (in)  encoding flags                     */
00622   unsigned char  **str,              /* (out) url-encoded value                  */
00623   unsigned int    *strLen);          /* (out) url-encoded value length           */
00624 
00676 int C_SetAttributesURLEncoded (
00677   ATTRIBUTES_OBJ  attributesObj,    /* (mod) attributes object        */
00678   unsigned char  *str,              /* (in)  url-encoded value        */
00679   unsigned int    strLen);          /* (in)  url-encoded value length */
00680 
00733 int C_SetAttributesNameValueEncoded (
00734   ATTRIBUTES_OBJ  attributesObj,    /* (mod) attributes object                  */
00735   unsigned char  *pInnerSep,        /* (in)  string separating name from value  */
00736   unsigned char  *pOuterSep,        /* (in)  string separating name-value pairs */
00737   unsigned char  *str,              /* (in)  url-encoded value                  */
00738   unsigned int    strLen);          /* (in)  url-encoded value length           */
00739 
00754 int C_ResetAttributesObject (
00755   ATTRIBUTES_OBJ attributesObj);   /* (mod) attributes object */
00756 
00774 void C_DestroyAttributesObject (
00775   ATTRIBUTES_OBJ *attributesObj);  /* (mod) attributes object */
00776 
00789 int C_DeleteSigningTimeAttribute (
00790   ATTRIBUTES_OBJ attributesObj);  /* (mod) attributes object */
00791 
00811 int C_GetSigningTimeAttribute (
00812   ATTRIBUTES_OBJ  attributesObj,   /* (in)  attributes object          */
00813   UINT4          *signingTime);    /* (out) when signature was created */
00814 
00837 int C_SetSigningTimeAttribute (
00838   ATTRIBUTES_OBJ attributesObj,   /* (mod) attributes object          */
00839   UINT4          signingTime);    /* (in)  when signature was created */
00840 
00853 int C_DeleteChallengePasswordAttrib (
00854   ATTRIBUTES_OBJ  attributesObj);   /* attributes object */
00855 
00891 int C_GetChallengePasswordAttribute (
00892   ATTRIBUTES_OBJ   attributesObj,   /* (in)  attributes object    */
00893   int             *valueTag,        /* (out) value character type */
00894   unsigned char  **value,           /* (out) value                */
00895   unsigned int    *valueLen);       /* (out) value length         */
00896 
00932 int C_SetChallengePasswordAttribute (
00933   ATTRIBUTES_OBJ  attributesObj,  /* (mod) attributes object         */
00934   int             valueTag,       /* (in)  value character type      */
00935   unsigned char  *value,          /* (in)  attribute value           */
00936   unsigned int    valueLen);      /* (in)  length of attribute value */
00937 
00973 int C_AddPostalAddressValue (
00974   ATTRIBUTES_OBJ  attributesObj,  /* (mod) attributes object */
00975   POSTAL_ADDRESS *postalAddress); /* (in)  attribute value   */
00976 
00989 int C_DeletePostalAddressAttribute (
00990   ATTRIBUTES_OBJ  attributesObj);  /* (mod) attributes object */
00991 
01024 int C_GetPostalAddressValue (
01025   POSTAL_ADDRESS *postalAddress,   /* (out) attribute value          */
01026   ATTRIBUTES_OBJ  attributesObj,   /* (in)  attributes object        */
01027   unsigned int    valueIndex);     /* (in)  index of attribute value */
01028 
01044 int C_GetPostalAddressValueCount (
01045   unsigned int   *valueCount,      /* (out) # of attribute values */
01046   ATTRIBUTES_OBJ  attributesObj);  /* (in)  attributes object     */
01047 
01048 #ifdef __cplusplus
01049 }
01050 #endif
01051 
01052 #endif /* HEADER_BSAFE_CERTC_CERTATTR */



RSA BSAFE® Cert-C 2.7 API Reference