| RSA BSAFE Cert-C |
Certificate Components for C |
| Crypto-C 6.2.1 Developer's Guide | ||
| Search |
00001 /* $Id: certattr.h,v 1.10 2005/01/25 05:50:29 jmckee Exp $ */ 00002 /* 00003 * Copyright (c) RSA Security Inc., 1999-2003. All rights reserved. 00004 * This work contains proprietary, confidential, and trade secret 00005 * information of RSA Security Inc. Use, disclosure or reproduction 00006 * without the express written authorization of RSA Security Inc. is 00007 * prohibited. 00008 */ 00009 00010 #ifndef HEADER_BSAFE_CERTC_CERTATTR 00011 #define HEADER_BSAFE_CERTC_CERTATTR 1 00012 00018 #include "basetype.h" 00019 #include "asn1pub.h" 00020 00021 #ifdef __cplusplus 00022 extern "C" { 00023 #endif 00024 00025 /* Default name attribute types. 00026 */ 00027 extern unsigned char AT_SERIAL_NUMBER[]; 00028 extern unsigned char AT_COUNTRY[]; 00029 extern unsigned char AT_STATE[]; 00030 extern unsigned char AT_LOCALITY[]; 00031 extern unsigned char AT_ORGANIZATION[]; 00032 extern unsigned char AT_ORG_UNIT[]; 00033 extern unsigned char AT_COMMON_NAME[]; 00034 extern unsigned char AT_TITLE[]; 00035 extern unsigned char AT_STREET_ADDRESS[]; 00036 extern unsigned char AT_POSTAL_CODE[]; 00037 extern unsigned char AT_EMAIL_ADDRESS[]; 00038 extern unsigned char AT_DN_QUALIFIER[]; 00039 extern unsigned char AT_SURNAME[]; 00040 extern unsigned char AT_GIVEN_NAME[]; 00041 extern unsigned char AT_INITIALS[]; 00042 extern unsigned char AT_GENERATION_QUALIFIER[]; 00043 extern unsigned char AT_DOMAIN_COMPONENT[]; 00044 extern unsigned char AT_NAME[]; 00045 00046 /* Default name attribute type lengths. 00047 */ 00048 #define AT_SERIAL_NUMBER_LEN 3 00049 #define AT_COUNTRY_LEN 3 00050 #define AT_STATE_LEN 3 00051 #define AT_LOCALITY_LEN 3 00052 #define AT_ORGANIZATION_LEN 3 00053 #define AT_ORG_UNIT_LEN 3 00054 #define AT_COMMON_NAME_LEN 3 00055 #define AT_TITLE_LEN 3 00056 #define AT_STREET_ADDRESS_LEN 3 00057 #define AT_POSTAL_CODE_LEN 3 00058 #define AT_EMAIL_ADDRESS_LEN 9 00059 #define AT_DN_QUALIFIER_LEN 3 00060 #define AT_SURNAME_LEN 3 00061 #define AT_GIVEN_NAME_LEN 3 00062 #define AT_INITIALS_LEN 3 00063 #define AT_GENERATION_QUALIFIER_LEN 3 00064 #define AT_DOMAIN_COMPONENT_LEN 10 00065 #define AT_NAME_LEN 3 00066 00067 /* RSA X.509 v3 Extensions attribute */ 00068 extern unsigned char AT_X509_V3_EXTENSIONS[]; 00069 #define AT_X509_V3_EXTENSIONS_LEN 9 00070 00071 /* Postal address attribute. 00072 */ 00073 #define MAX_ADDRESS_LINE_COUNT 6 00074 #define MAX_ADDRESS_LINE_LEN 30 00075 00079 typedef struct { 00080 00086 unsigned int count; 00087 struct { 00088 00102 int tag; 00103 unsigned char *value; 00104 unsigned int valueLen; 00105 } lines[MAX_ADDRESS_LINE_COUNT]; 00106 } POSTAL_ADDRESS; 00107 00108 /* Default name attribute value length limits. 00109 */ 00110 #define COUNTRY_LEN 2 00111 #define MAX_SERIAL_NUMBER_LEN 64 00112 #define MAX_STATE_LEN 128 00113 #define MAX_LOCALITY_LEN 128 00114 #define MAX_ORGANIZATION_LEN 64 00115 #define MAX_ORG_UNIT_LEN 64 00116 #define MAX_COMMON_NAME_LEN 64 00117 #define MAX_TITLE_LEN 64 00118 #define MAX_STREET_ADDRESS_LEN 128 00119 #define MAX_POSTAL_CODE_LEN 40 00120 #define MAX_EMAIL_ADDRESS_LEN 128 00121 #define MAX_DOMAIN_COMPONENT_LEN 64 00122 #define MAX_NAME_LEN 32768 00123 00124 /* Other constants */ 00125 #define MAX_DIGEST_LEN 20 00126 00127 00128 #define NV_FLAGS_SORTED 0x00000001 00129 #define NV_FLAGS_SUPPRESS_FINAL_SEP 0x00000002 00130 00131 int C_CreateAttributesObject ( 00132 ATTRIBUTES_OBJ *attributesObj); /* (out) attributes object */ 00133 00134 int C_GetAttributesDER ( 00135 ATTRIBUTES_OBJ attributesObj, /* (in) attributes object */ 00136 unsigned char **der, /* (out) encoded attributes */ 00137 unsigned int *derLen); /* (out) encoded attributes length */ 00138 00139 int C_SetAttributesBER ( 00140 ATTRIBUTES_OBJ attributesObj, /* (mod) attributes object */ 00141 unsigned char *ber, /* (in) encoded attributes */ 00142 unsigned int berLen); /* (in) encoded attributes length */ 00143 00144 int C_GetAttributeTypeCount ( 00145 ATTRIBUTES_OBJ attributesObj, /* (in) attributes object */ 00146 unsigned int *count); /* (out) # of distinct attributes */ 00147 00148 int C_GetAttributeType ( 00149 ATTRIBUTES_OBJ attributesObj, /* (in) attributes object */ 00150 unsigned int index, /* (in) index of attribute */ 00151 unsigned char **type, /* (out) attribute type */ 00152 unsigned int *typeLen); /* (out) attribute type length */ 00153 00154 int C_GetAttributeValueCount ( 00155 ATTRIBUTES_OBJ attributesObj, /* (in) attributes object */ 00156 unsigned char *type, /* (in) attribute type */ 00157 unsigned int typeLen, /* (in) attribute type length */ 00158 unsigned int *count); /* (out) value count */ 00159 00160 int C_GetAttributeValueDER ( 00161 ATTRIBUTES_OBJ attributesObj, /* (in) attributes object */ 00162 unsigned char *type, /* (in) attribute type */ 00163 unsigned int typeLen, /* (in) attribute type length */ 00164 unsigned int valueIndex, /* (in) value index */ 00165 unsigned char **valueDER, /* (out) encoded value */ 00166 unsigned int *valueDERLen); /* (out) encoded value length */ 00167 00168 int C_GetStringAttribute ( 00169 ATTRIBUTES_OBJ attributesObj, /* (in) attributes object */ 00170 unsigned char *type, /* (in) attribute type */ 00171 unsigned int typeLen, /* (in) attribute type length */ 00172 unsigned int valueIndex, /* (in) value index */ 00173 int *valueTag, /* (out) value character type */ 00174 unsigned char **value, /* (out) value */ 00175 unsigned int *valueLen); /* (out) value length */ 00176 00177 int C_DeleteAttributeType ( 00178 ATTRIBUTES_OBJ attributesObj, /* (mod) attributes object */ 00179 unsigned char *type, /* (in) attribute type */ 00180 unsigned int typeLen); /* (in) attribute type length */ 00181 00182 int C_AddAttributeValueBER ( 00183 ATTRIBUTES_OBJ attributesObj, /* (mod) attributes object */ 00184 unsigned char *type, /* (in) attribute type */ 00185 unsigned int typeLen, /* (in) attribute type length */ 00186 unsigned char *value, /* (in) attribute value */ 00187 unsigned int valueLen); /* (in) length of attribute value */ 00188 00189 int C_AddStringAttribute ( 00190 ATTRIBUTES_OBJ attributesObj, /* (mod) attributes object */ 00191 unsigned char *type, /* (in) attribute type */ 00192 unsigned int typeLen, /* (in) attribute type length */ 00193 int valueTag, /* (in) value character type */ 00194 unsigned char *value, /* (in) attribute value */ 00195 unsigned int valueLen); /* (in) length of attribute value */ 00196 00197 int C_GetAttributesURLEncoded ( 00198 ATTRIBUTES_OBJ attributesObj, /* (in) attributes object */ 00199 unsigned char **str, /* (out) url-encoded value */ 00200 unsigned int *strLen); /* (out) url-encoded value length */ 00201 00202 int C_GetAttributesNameValueEncoded( 00203 ATTRIBUTES_OBJ attributesObj, /* (in) attributes object */ 00204 unsigned char *pInnerSep, /* (in) string separating name from value */ 00205 unsigned char *pOuterSep, /* (in) string separating name-value pairs */ 00206 unsigned int flags, /* (in) encoding flags */ 00207 unsigned char **str, /* (out) url-encoded value */ 00208 unsigned int *strLen); /* (out) url-encoded value length */ 00209 00210 int C_SetAttributesURLEncoded ( 00211 ATTRIBUTES_OBJ attributesObj, /* (mod) attributes object */ 00212 unsigned char *str, /* (in) url-encoded value */ 00213 unsigned int strLen); /* (in) url-encoded value length */ 00214 00215 int C_SetAttributesNameValueEncoded ( 00216 ATTRIBUTES_OBJ attributesObj, /* (mod) attributes object */ 00217 unsigned char *pInnerSep, /* (in) string separating name from value */ 00218 unsigned char *pOuterSep, /* (in) string separating name-value pairs */ 00219 unsigned char *str, /* (in) url-encoded value */ 00220 unsigned int strLen); /* (in) url-encoded value length */ 00221 00222 int C_ResetAttributesObject ( 00223 ATTRIBUTES_OBJ attributesObj); /* (mod) attributes object */ 00224 00225 void C_DestroyAttributesObject ( 00226 ATTRIBUTES_OBJ *attributesObj); /* (mod) attributes object */ 00227 00228 int C_DeleteSigningTimeAttribute ( 00229 ATTRIBUTES_OBJ attributesObj); /* (mod) attributes object */ 00230 00231 int C_GetSigningTimeAttribute ( 00232 ATTRIBUTES_OBJ attributesObj, /* (in) attributes object */ 00233 UINT4 *signingTime); /* (out) when signature was created */ 00234 00235 int C_SetSigningTimeAttribute ( 00236 ATTRIBUTES_OBJ attributesObj, /* (mod) attributes object */ 00237 UINT4 signingTime); /* (in) when signature was created */ 00238 00239 int C_DeleteChallengePasswordAttrib ( 00240 ATTRIBUTES_OBJ attributesObj); /* attributes object */ 00241 00242 int C_GetChallengePasswordAttribute ( 00243 ATTRIBUTES_OBJ attributesObj, /* (in) attributes object */ 00244 int *valueTag, /* (out) value character type */ 00245 unsigned char **value, /* (out) value */ 00246 unsigned int *valueLen); /* (out) value length */ 00247 00248 int C_SetChallengePasswordAttribute ( 00249 ATTRIBUTES_OBJ attributesObj, /* (mod) attributes object */ 00250 int valueTag, /* (in) value character type */ 00251 unsigned char *value, /* (in) attribute value */ 00252 unsigned int valueLen); /* (in) length of attribute value */ 00253 00254 int C_AddPostalAddressValue ( 00255 ATTRIBUTES_OBJ attributesObj, /* (mod) attributes object */ 00256 POSTAL_ADDRESS *postalAddress); /* (in) attribute value */ 00257 00258 int C_DeletePostalAddressAttribute ( 00259 ATTRIBUTES_OBJ attributesObj); /* (mod) attributes object */ 00260 00261 int C_GetPostalAddressValue ( 00262 POSTAL_ADDRESS *postalAddress, /* (out) attribute value */ 00263 ATTRIBUTES_OBJ attributesObj, /* (in) attributes object */ 00264 unsigned int valueIndex); /* (in) index of attribute value */ 00265 00266 int C_GetPostalAddressValueCount ( 00267 unsigned int *valueCount, /* (out) # of attribute values */ 00268 ATTRIBUTES_OBJ attributesObj); /* (in) attributes object */ 00269 00270 #ifdef __cplusplus 00271 } 00272 #endif 00273 00274 #endif /* HEADER_BSAFE_CERTC_CERTATTR */