x509v3.h

Go to the documentation of this file.
00001 /* x509v3.h */
00002 /* Written by Dr Stephen N Henson ([email protected]) for the OpenSSL
00003  * project 1999.
00004  */
00005 /* ====================================================================
00006  * Copyright (c) 1999-2004 The OpenSSL Project.  All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  *
00012  * 1. Redistributions of source code must retain the above copyright
00013  *    notice, this list of conditions and the following disclaimer. 
00014  *
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in
00017  *    the documentation and/or other materials provided with the
00018  *    distribution.
00019  *
00020  * 3. All advertising materials mentioning features or use of this
00021  *    software must display the following acknowledgment:
00022  *    "This product includes software developed by the OpenSSL Project
00023  *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
00024  *
00025  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
00026  *    endorse or promote products derived from this software without
00027  *    prior written permission. For written permission, please contact
00028  *    [email protected]
00029  *
00030  * 5. Products derived from this software may not be called "OpenSSL"
00031  *    nor may "OpenSSL" appear in their names without prior written
00032  *    permission of the OpenSSL Project.
00033  *
00034  * 6. Redistributions of any form whatsoever must retain the following
00035  *    acknowledgment:
00036  *    "This product includes software developed by the OpenSSL Project
00037  *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
00038  *
00039  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
00040  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00041  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00042  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
00043  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00044  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00045  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00046  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00047  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00048  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00049  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00050  * OF THE POSSIBILITY OF SUCH DAMAGE.
00051  * ====================================================================
00052  *
00053  * This product includes cryptographic software written by Eric Young
00054  * ([email protected]).  This product includes software written by Tim
00055  * Hudson ([email protected]).
00056  *
00057  */
00058  /*
00059  © Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
00060  */
00061 
00062 #ifndef HEADER_X509V3_H
00063 #define HEADER_X509V3_H
00064 
00065 #if (defined(__SYMBIAN32__) && !defined(SYMBIAN))
00066 #define SYMBIAN
00067 #endif
00068 
00069 #ifdef SYMBIAN
00070 #include <e32def.h>
00071 #endif
00072 #include <openssl/bio.h>
00073 #include <openssl/x509.h>
00074 #include <openssl/conf.h>
00075 
00076 #ifdef __cplusplus
00077 extern "C" {
00078 #endif
00079 
00080 /* Forward reference */
00081 struct v3_ext_method;
00082 struct v3_ext_ctx;
00083 
00084 /* Useful typedefs */
00085 
00086 typedef void * (*X509V3_EXT_NEW)(void);
00087 typedef void (*X509V3_EXT_FREE)(void *);
00088 typedef void * (*X509V3_EXT_D2I)(void *, const unsigned char ** , long);
00089 typedef int (*X509V3_EXT_I2D)(void *, unsigned char **);
00090 typedef STACK_OF(CONF_VALUE) * (*X509V3_EXT_I2V)(struct v3_ext_method *method, void *ext, STACK_OF(CONF_VALUE) *extlist);
00091 typedef void * (*X509V3_EXT_V2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, STACK_OF(CONF_VALUE) *values);
00092 typedef char * (*X509V3_EXT_I2S)(struct v3_ext_method *method, void *ext);
00093 typedef void * (*X509V3_EXT_S2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, const char *str);
00094 typedef int (*X509V3_EXT_I2R)(struct v3_ext_method *method, void *ext, BIO *out, int indent);
00095 typedef void * (*X509V3_EXT_R2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, const char *str);
00096 
00097 /* V3 extension structure */
00098 
00099 struct v3_ext_method {
00100 int ext_nid;
00101 int ext_flags;
00102 /* If this is set the following four fields are ignored */
00103 ASN1_ITEM_EXP *it;
00104 /* Old style ASN1 calls */
00105 X509V3_EXT_NEW ext_new;
00106 X509V3_EXT_FREE ext_free;
00107 X509V3_EXT_D2I d2i;
00108 X509V3_EXT_I2D i2d;
00109 
00110 /* The following pair is used for string extensions */
00111 X509V3_EXT_I2S i2s;
00112 X509V3_EXT_S2I s2i;
00113 
00114 /* The following pair is used for multi-valued extensions */
00115 X509V3_EXT_I2V i2v;
00116 X509V3_EXT_V2I v2i;
00117 
00118 /* The following are used for raw extensions */
00119 X509V3_EXT_I2R i2r;
00120 X509V3_EXT_R2I r2i;
00121 
00122 void *usr_data; /* Any extension specific data */
00123 };
00124 
00125 typedef struct X509V3_CONF_METHOD_st {
00126 char * (*get_string)(void *db, char *section, char *value);
00127 STACK_OF(CONF_VALUE) * (*get_section)(void *db, char *section);
00128 void (*free_string)(void *db, char * string);
00129 void (*free_section)(void *db, STACK_OF(CONF_VALUE) *section);
00130 } X509V3_CONF_METHOD;
00131 
00132 /* Context specific info */
00133 struct v3_ext_ctx {
00134 #define CTX_TEST 0x1
00135 int flags;
00136 X509 *issuer_cert;
00137 X509 *subject_cert;
00138 X509_REQ *subject_req;
00139 X509_CRL *crl;
00140 X509V3_CONF_METHOD *db_meth;
00141 void *db;
00142 /* Maybe more here */
00143 };
00144 
00145 typedef struct v3_ext_method X509V3_EXT_METHOD;
00146 
00147 DECLARE_STACK_OF(X509V3_EXT_METHOD)
00148 
00149 /* ext_flags values */
00150 #define X509V3_EXT_DYNAMIC      0x1
00151 #define X509V3_EXT_CTX_DEP      0x2
00152 #define X509V3_EXT_MULTILINE    0x4
00153 
00154 typedef BIT_STRING_BITNAME ENUMERATED_NAMES;
00155 
00156 typedef struct BASIC_CONSTRAINTS_st {
00157 int ca;
00158 ASN1_INTEGER *pathlen;
00159 } BASIC_CONSTRAINTS;
00160 
00161 
00162 typedef struct PKEY_USAGE_PERIOD_st {
00163 ASN1_GENERALIZEDTIME *notBefore;
00164 ASN1_GENERALIZEDTIME *notAfter;
00165 } PKEY_USAGE_PERIOD;
00166 
00167 typedef struct otherName_st {
00168 ASN1_OBJECT *type_id;
00169 ASN1_TYPE *value;
00170 } OTHERNAME;
00171 
00172 typedef struct EDIPartyName_st {
00173         ASN1_STRING *nameAssigner;
00174         ASN1_STRING *partyName;
00175 } EDIPARTYNAME;
00176 
00177 typedef struct GENERAL_NAME_st {
00178 
00179 #define GEN_OTHERNAME   0
00180 #define GEN_EMAIL       1
00181 #define GEN_DNS         2
00182 #define GEN_X400        3
00183 #define GEN_DIRNAME     4
00184 #define GEN_EDIPARTY    5
00185 #define GEN_URI         6
00186 #define GEN_IPADD       7
00187 #define GEN_RID         8
00188 
00189 int type;
00190 union {
00191         char *ptr;
00192         OTHERNAME *otherName; /* otherName */
00193         ASN1_IA5STRING *rfc822Name;
00194         ASN1_IA5STRING *dNSName;
00195         ASN1_TYPE *x400Address;
00196         X509_NAME *directoryName;
00197         EDIPARTYNAME *ediPartyName;
00198         ASN1_IA5STRING *uniformResourceIdentifier;
00199         ASN1_OCTET_STRING *iPAddress;
00200         ASN1_OBJECT *registeredID;
00201 
00202         /* Old names */
00203         ASN1_OCTET_STRING *ip; /* iPAddress */
00204         X509_NAME *dirn;                /* dirn */
00205         ASN1_IA5STRING *ia5;/* rfc822Name, dNSName, uniformResourceIdentifier */
00206         ASN1_OBJECT *rid; /* registeredID */
00207         ASN1_TYPE *other; /* x400Address */
00208 } d;
00209 } GENERAL_NAME;
00210 
00211 typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES;
00212 
00213 typedef struct ACCESS_DESCRIPTION_st {
00214         ASN1_OBJECT *method;
00215         GENERAL_NAME *location;
00216 } ACCESS_DESCRIPTION;
00217 
00218 typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS;
00219 
00220 typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE;
00221 
00222 DECLARE_STACK_OF(GENERAL_NAME)
00223 DECLARE_ASN1_SET_OF(GENERAL_NAME)
00224 
00225 DECLARE_STACK_OF(ACCESS_DESCRIPTION)
00226 DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION)
00227 
00228 typedef struct DIST_POINT_NAME_st {
00229 int type;
00230 union {
00231         GENERAL_NAMES *fullname;
00232         STACK_OF(X509_NAME_ENTRY) *relativename;
00233 } name;
00234 } DIST_POINT_NAME;
00235 
00236 typedef struct DIST_POINT_st {
00237 DIST_POINT_NAME *distpoint;
00238 ASN1_BIT_STRING *reasons;
00239 GENERAL_NAMES *CRLissuer;
00240 } DIST_POINT;
00241 
00242 typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS;
00243 
00244 DECLARE_STACK_OF(DIST_POINT)
00245 DECLARE_ASN1_SET_OF(DIST_POINT)
00246 
00247 typedef struct AUTHORITY_KEYID_st {
00248 ASN1_OCTET_STRING *keyid;
00249 GENERAL_NAMES *issuer;
00250 ASN1_INTEGER *serial;
00251 } AUTHORITY_KEYID;
00252 
00253 /* Strong extranet structures */
00254 
00255 typedef struct SXNET_ID_st {
00256         ASN1_INTEGER *zone;
00257         ASN1_OCTET_STRING *user;
00258 } SXNETID;
00259 
00260 DECLARE_STACK_OF(SXNETID)
00261 DECLARE_ASN1_SET_OF(SXNETID)
00262 
00263 typedef struct SXNET_st {
00264         ASN1_INTEGER *version;
00265         STACK_OF(SXNETID) *ids;
00266 } SXNET;
00267 
00268 typedef struct NOTICEREF_st {
00269         ASN1_STRING *organization;
00270         STACK_OF(ASN1_INTEGER) *noticenos;
00271 } NOTICEREF;
00272 
00273 typedef struct USERNOTICE_st {
00274         NOTICEREF *noticeref;
00275         ASN1_STRING *exptext;
00276 } USERNOTICE;
00277 
00278 typedef struct POLICYQUALINFO_st {
00279         ASN1_OBJECT *pqualid;
00280         union {
00281                 ASN1_IA5STRING *cpsuri;
00282                 USERNOTICE *usernotice;
00283                 ASN1_TYPE *other;
00284         } d;
00285 } POLICYQUALINFO;
00286 
00287 DECLARE_STACK_OF(POLICYQUALINFO)
00288 DECLARE_ASN1_SET_OF(POLICYQUALINFO)
00289 
00290 typedef struct POLICYINFO_st {
00291         ASN1_OBJECT *policyid;
00292         STACK_OF(POLICYQUALINFO) *qualifiers;
00293 } POLICYINFO;
00294 
00295 typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES;
00296 
00297 DECLARE_STACK_OF(POLICYINFO)
00298 DECLARE_ASN1_SET_OF(POLICYINFO)
00299 
00300 typedef struct POLICY_MAPPING_st {
00301         ASN1_OBJECT *issuerDomainPolicy;
00302         ASN1_OBJECT *subjectDomainPolicy;
00303 } POLICY_MAPPING;
00304 
00305 DECLARE_STACK_OF(POLICY_MAPPING)
00306 
00307 typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS;
00308 
00309 typedef struct GENERAL_SUBTREE_st {
00310         GENERAL_NAME *base;
00311         ASN1_INTEGER *minimum;
00312         ASN1_INTEGER *maximum;
00313 } GENERAL_SUBTREE;
00314 
00315 DECLARE_STACK_OF(GENERAL_SUBTREE)
00316 
00317 typedef struct NAME_CONSTRAINTS_st {
00318         STACK_OF(GENERAL_SUBTREE) *permittedSubtrees;
00319         STACK_OF(GENERAL_SUBTREE) *excludedSubtrees;
00320 } NAME_CONSTRAINTS;
00321 
00322 typedef struct POLICY_CONSTRAINTS_st {
00323         ASN1_INTEGER *requireExplicitPolicy;
00324         ASN1_INTEGER *inhibitPolicyMapping;
00325 } POLICY_CONSTRAINTS;
00326 
00327 /* Proxy certificate structures, see RFC 3820 */
00328 typedef struct PROXY_POLICY_st
00329         {
00330         ASN1_OBJECT *policyLanguage;
00331         ASN1_OCTET_STRING *policy;
00332         } PROXY_POLICY;
00333 
00334 typedef struct PROXY_CERT_INFO_EXTENSION_st
00335         {
00336         ASN1_INTEGER *pcPathLengthConstraint;
00337         PROXY_POLICY *proxyPolicy;
00338         } PROXY_CERT_INFO_EXTENSION;
00339 
00340 DECLARE_ASN1_FUNCTIONS(PROXY_POLICY)
00341 DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION)
00342 
00343 
00344 #define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \
00345 ",name:", val->name, ",value:", val->value);
00346 
00347 #define X509V3_set_ctx_test(ctx) \
00348                         X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST)
00349 #define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL;
00350 
00351 #define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \
00352                         0,0,0,0, \
00353                         0,0, \
00354                         (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \
00355                         (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \
00356                         NULL, NULL, \
00357                         table}
00358 
00359 #define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \
00360                         0,0,0,0, \
00361                         (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \
00362                         (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \
00363                         0,0,0,0, \
00364                         NULL}
00365 
00366 #define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
00367 
00368 
00369 /* X509_PURPOSE stuff */
00370 
00371 #define EXFLAG_BCONS            0x1
00372 #define EXFLAG_KUSAGE           0x2
00373 #define EXFLAG_XKUSAGE          0x4
00374 #define EXFLAG_NSCERT           0x8
00375 
00376 #define EXFLAG_CA               0x10
00377 #define EXFLAG_SS               0x20
00378 #define EXFLAG_V1               0x40
00379 #define EXFLAG_INVALID          0x80
00380 #define EXFLAG_SET              0x100
00381 #define EXFLAG_CRITICAL         0x200
00382 #define EXFLAG_PROXY            0x400
00383 
00384 #define EXFLAG_INVALID_POLICY   0x400
00385 
00386 #define KU_DIGITAL_SIGNATURE    0x0080
00387 #define KU_NON_REPUDIATION      0x0040
00388 #define KU_KEY_ENCIPHERMENT     0x0020
00389 #define KU_DATA_ENCIPHERMENT    0x0010
00390 #define KU_KEY_AGREEMENT        0x0008
00391 #define KU_KEY_CERT_SIGN        0x0004
00392 #define KU_CRL_SIGN             0x0002
00393 #define KU_ENCIPHER_ONLY        0x0001
00394 #define KU_DECIPHER_ONLY        0x8000
00395 
00396 #define NS_SSL_CLIENT           0x80
00397 #define NS_SSL_SERVER           0x40
00398 #define NS_SMIME                0x20
00399 #define NS_OBJSIGN              0x10
00400 #define NS_SSL_CA               0x04
00401 #define NS_SMIME_CA             0x02
00402 #define NS_OBJSIGN_CA           0x01
00403 #define NS_ANY_CA               (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA)
00404 
00405 #define XKU_SSL_SERVER          0x1     
00406 #define XKU_SSL_CLIENT          0x2
00407 #define XKU_SMIME               0x4
00408 #define XKU_CODE_SIGN           0x8
00409 #define XKU_SGC                 0x10
00410 #define XKU_OCSP_SIGN           0x20
00411 #define XKU_TIMESTAMP           0x40
00412 #define XKU_DVCS                0x80
00413 
00414 #define X509_PURPOSE_DYNAMIC    0x1
00415 #define X509_PURPOSE_DYNAMIC_NAME       0x2
00416 
00417 typedef struct x509_purpose_st {
00418         int purpose;
00419         int trust;              /* Default trust ID */
00420         int flags;
00421         int (*check_purpose)(const struct x509_purpose_st *,
00422                                 const X509 *, int);
00423         char *name;
00424         char *sname;
00425         void *usr_data;
00426 } X509_PURPOSE;
00427 
00428 #define X509_PURPOSE_SSL_CLIENT         1
00429 #define X509_PURPOSE_SSL_SERVER         2
00430 #define X509_PURPOSE_NS_SSL_SERVER      3
00431 #define X509_PURPOSE_SMIME_SIGN         4
00432 #define X509_PURPOSE_SMIME_ENCRYPT      5
00433 #define X509_PURPOSE_CRL_SIGN           6
00434 #define X509_PURPOSE_ANY                7
00435 #define X509_PURPOSE_OCSP_HELPER        8
00436 
00437 #define X509_PURPOSE_MIN                1
00438 #define X509_PURPOSE_MAX                8
00439 
00440 /* Flags for X509V3_EXT_print() */
00441 
00442 #define X509V3_EXT_UNKNOWN_MASK         (0xfL << 16)
00443 /* Return error for unknown extensions */
00444 #define X509V3_EXT_DEFAULT              0
00445 /* Print error for unknown extensions */
00446 #define X509V3_EXT_ERROR_UNKNOWN        (1L << 16)
00447 /* ASN1 parse unknown extensions */
00448 #define X509V3_EXT_PARSE_UNKNOWN        (2L << 16)
00449 /* BIO_dump unknown extensions */
00450 #define X509V3_EXT_DUMP_UNKNOWN         (3L << 16)
00451 
00452 /* Flags for X509V3_add1_i2d */
00453 
00454 #define X509V3_ADD_OP_MASK              0xfL
00455 #define X509V3_ADD_DEFAULT              0L
00456 #define X509V3_ADD_APPEND               1L
00457 #define X509V3_ADD_REPLACE              2L
00458 #define X509V3_ADD_REPLACE_EXISTING     3L
00459 #define X509V3_ADD_KEEP_EXISTING        4L
00460 #define X509V3_ADD_DELETE               5L
00461 #define X509V3_ADD_SILENT               0x10
00462 
00463 DECLARE_STACK_OF(X509_PURPOSE)
00464 
00465 DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS)
00466 
00467 DECLARE_ASN1_FUNCTIONS(SXNET)
00468 DECLARE_ASN1_FUNCTIONS(SXNETID)
00469 
00470 IMPORT_C int SXNET_add_id_asc(SXNET **psx, char *zone, char *user, int userlen); 
00471 IMPORT_C int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, char *user, int userlen); 
00472 IMPORT_C int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, char *user, int userlen); 
00473 
00474 IMPORT_C ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, char *zone);
00475 IMPORT_C ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone);
00476 IMPORT_C ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone);
00477 
00478 DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID)
00479 
00480 DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD)
00481 
00482 DECLARE_ASN1_FUNCTIONS(GENERAL_NAME)
00483 
00484 
00485 IMPORT_C ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
00486                                 X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
00487 IMPORT_C STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
00488                                 ASN1_BIT_STRING *bits,
00489                                 STACK_OF(CONF_VALUE) *extlist);
00490 
00491 IMPORT_C STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, GENERAL_NAME *gen, STACK_OF(CONF_VALUE) *ret);
00492 int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen);
00493 
00494 DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES)
00495 
00496 IMPORT_C STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method,
00497                 GENERAL_NAMES *gen, STACK_OF(CONF_VALUE) *extlist);
00498 GENERAL_NAMES *v2i_GENERAL_NAMES(X509V3_EXT_METHOD *method,
00499                                 X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
00500 
00501 DECLARE_ASN1_FUNCTIONS(OTHERNAME)
00502 DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME)
00503 
00504 IMPORT_C char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5);
00505 ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *str);
00506 
00507 DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE)
00508 IMPORT_C int i2a_ACCESS_DESCRIPTION(BIO *bp, ACCESS_DESCRIPTION* a);
00509 
00510 DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES)
00511 DECLARE_ASN1_FUNCTIONS(POLICYINFO)
00512 DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO)
00513 DECLARE_ASN1_FUNCTIONS(USERNOTICE)
00514 DECLARE_ASN1_FUNCTIONS(NOTICEREF)
00515 
00516 DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS)
00517 DECLARE_ASN1_FUNCTIONS(DIST_POINT)
00518 DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME)
00519 
00520 DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION)
00521 DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS)
00522 
00523 DECLARE_ASN1_ITEM(POLICY_MAPPING)
00524 DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING)
00525 DECLARE_ASN1_ITEM(POLICY_MAPPINGS)
00526 
00527 DECLARE_ASN1_ITEM(GENERAL_SUBTREE)
00528 DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE)
00529 
00530 DECLARE_ASN1_ITEM(NAME_CONSTRAINTS)
00531 DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)
00532 
00533 DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS)
00534 DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS)
00535 
00536 #ifdef HEADER_CONF_H
00537 IMPORT_C GENERAL_NAME *v2i_GENERAL_NAME(X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
00538                                                         CONF_VALUE *cnf);
00539 IMPORT_C GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, X509V3_EXT_METHOD *method,
00540                                 X509V3_CTX *ctx, CONF_VALUE *cnf, int is_nc);
00541 IMPORT_C void X509V3_conf_free(CONF_VALUE *val);
00542 
00543 IMPORT_C X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, char *value);
00544 IMPORT_C X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, char *name, char *value);
00545 IMPORT_C int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, char *section, STACK_OF(X509_EXTENSION) **sk);
00546 IMPORT_C int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509 *cert);
00547 IMPORT_C int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_REQ *req);
00548 IMPORT_C int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl);
00549 
00550 IMPORT_C X509_EXTENSION *X509V3_EXT_conf_nid(LHASH *conf, X509V3_CTX *ctx, int ext_nid, char *value);
00551 IMPORT_C X509_EXTENSION *X509V3_EXT_conf(LHASH *conf, X509V3_CTX *ctx, char *name, char *value);
00552 IMPORT_C int X509V3_EXT_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509 *cert);
00553 IMPORT_C int X509V3_EXT_REQ_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509_REQ *req);
00554 IMPORT_C int X509V3_EXT_CRL_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl);
00555 
00556 IMPORT_C int X509V3_add_value_bool_nf(char *name, int asn1_bool,
00557                                                 STACK_OF(CONF_VALUE) **extlist);
00558 IMPORT_C int X509V3_get_value_bool(CONF_VALUE *value, int *asn1_bool);
00559 IMPORT_C int X509V3_get_value_int(CONF_VALUE *value, ASN1_INTEGER **aint);
00560 IMPORT_C void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf);
00561 IMPORT_C void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH *lhash);
00562 #endif
00563 
00564 IMPORT_C char * X509V3_get_string(X509V3_CTX *ctx, char *name, char *section);
00565 IMPORT_C STACK_OF(CONF_VALUE) * X509V3_get_section(X509V3_CTX *ctx, char *section);
00566 IMPORT_C void X509V3_string_free(X509V3_CTX *ctx, char *str);
00567 IMPORT_C void X509V3_section_free( X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section);
00568 IMPORT_C void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject,
00569                                  X509_REQ *req, X509_CRL *crl, int flags);
00570 
00571 IMPORT_C int X509V3_add_value(const char *name, const char *value,
00572                                                 STACK_OF(CONF_VALUE) **extlist);
00573 IMPORT_C int X509V3_add_value_uchar(const char *name, const unsigned char *value,
00574                                                 STACK_OF(CONF_VALUE) **extlist);
00575 IMPORT_C int X509V3_add_value_bool(const char *name, int asn1_bool,
00576                                                 STACK_OF(CONF_VALUE) **extlist);
00577 IMPORT_C int X509V3_add_value_int(const char *name, ASN1_INTEGER *aint,
00578                                                 STACK_OF(CONF_VALUE) **extlist);
00579 IMPORT_C char * i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint);
00580 IMPORT_C ASN1_INTEGER * s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, char *value);
00581 IMPORT_C char * i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint);
00582 IMPORT_C char * i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint);
00583 IMPORT_C int X509V3_EXT_add(X509V3_EXT_METHOD *ext);
00584 IMPORT_C int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist);
00585 IMPORT_C int X509V3_EXT_add_alias(int nid_to, int nid_from);
00586 IMPORT_C void X509V3_EXT_cleanup(void);
00587 
00588 IMPORT_C X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext);
00589 IMPORT_C X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid);
00590 IMPORT_C int X509V3_add_standard_extensions(void);
00591 IMPORT_C STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line);
00592 IMPORT_C void *X509V3_EXT_d2i(X509_EXTENSION *ext);
00593 IMPORT_C void *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit, int *idx);
00594 
00595 
00596 IMPORT_C X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc);
00597 IMPORT_C int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, int crit, unsigned long flags);
00598 
00599 IMPORT_C char *hex_to_string(unsigned char *buffer, long len);
00600 IMPORT_C unsigned char *string_to_hex(char *str, long *len);
00601 IMPORT_C int name_cmp(const char *name, const char *cmp);
00602 
00603 IMPORT_C void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent,
00604                                                                  int ml);
00605 IMPORT_C int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int indent);
00606 IMPORT_C int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent);
00607 
00608 IMPORT_C int X509V3_extensions_print(BIO *out, char *title, STACK_OF(X509_EXTENSION) *exts, unsigned long flag, int indent);
00609 
00610 IMPORT_C int X509_check_ca(X509 *x);
00611 IMPORT_C int X509_check_purpose(X509 *x, int id, int ca);
00612 IMPORT_C int X509_supported_extension(X509_EXTENSION *ex);
00613 IMPORT_C int X509_PURPOSE_set(int *p, int purpose);
00614 IMPORT_C int X509_check_issued(X509 *issuer, X509 *subject);
00615 IMPORT_C int X509_PURPOSE_get_count(void);
00616 IMPORT_C X509_PURPOSE * X509_PURPOSE_get0(int idx);
00617 IMPORT_C int X509_PURPOSE_get_by_sname(char *sname);
00618 IMPORT_C int X509_PURPOSE_get_by_id(int id);
00619 IMPORT_C int X509_PURPOSE_add(int id, int trust, int flags,
00620                         int (*ck)(const X509_PURPOSE *, const X509 *, int),
00621                                 char *name, char *sname, void *arg);
00622 IMPORT_C char *X509_PURPOSE_get0_name(X509_PURPOSE *xp);
00623 IMPORT_C char *X509_PURPOSE_get0_sname(X509_PURPOSE *xp);
00624 IMPORT_C int X509_PURPOSE_get_trust(X509_PURPOSE *xp);
00625 IMPORT_C void X509_PURPOSE_cleanup(void);
00626 IMPORT_C int X509_PURPOSE_get_id(X509_PURPOSE *);
00627 
00628 IMPORT_C STACK *X509_get1_email(X509 *x);
00629 IMPORT_C STACK *X509_REQ_get1_email(X509_REQ *x);
00630 IMPORT_C void X509_email_free(STACK *sk);
00631 
00632 IMPORT_C ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc);
00633 IMPORT_C ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc);
00634 IMPORT_C int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE)*dn_sk,
00635                                                 unsigned long chtype);
00636 
00637 IMPORT_C void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent);
00638 
00639 /* BEGIN ERROR CODES */
00640 /* The following lines are auto generated by the script mkerr.pl. Any changes
00641  * made after this point may be overwritten when the script is next run.
00642  */
00643 IMPORT_C void ERR_load_X509V3_strings(void);
00644 
00645 /* Error codes for the X509V3 functions. */
00646 
00647 /* Function codes. */
00648 #define X509V3_F_COPY_EMAIL                              122
00649 #define X509V3_F_COPY_ISSUER                             123
00650 #define X509V3_F_DO_DIRNAME                              144
00651 #define X509V3_F_DO_EXT_CONF                             124
00652 #define X509V3_F_DO_EXT_I2D                              135
00653 #define X509V3_F_DO_EXT_NCONF                            151
00654 #define X509V3_F_DO_I2V_NAME_CONSTRAINTS                 148
00655 #define X509V3_F_HEX_TO_STRING                           111
00656 #define X509V3_F_I2S_ASN1_ENUMERATED                     121
00657 #define X509V3_F_I2S_ASN1_IA5STRING                      149
00658 #define X509V3_F_I2S_ASN1_INTEGER                        120
00659 #define X509V3_F_I2V_AUTHORITY_INFO_ACCESS               138
00660 #define X509V3_F_NOTICE_SECTION                          132
00661 #define X509V3_F_NREF_NOS                                133
00662 #define X509V3_F_POLICY_SECTION                          131
00663 #define X509V3_F_PROCESS_PCI_VALUE                       150
00664 #define X509V3_F_R2I_CERTPOL                             130
00665 #define X509V3_F_R2I_PCI                                 149
00666 #define X509V3_F_S2I_ASN1_IA5STRING                      100
00667 #define X509V3_F_S2I_ASN1_INTEGER                        108
00668 #define X509V3_F_S2I_ASN1_OCTET_STRING                   112
00669 #define X509V3_F_S2I_ASN1_SKEY_ID                        114
00670 #define X509V3_F_S2I_SKEY_ID                             115
00671 #define X509V3_F_STRING_TO_HEX                           113
00672 #define X509V3_F_SXNET_ADD_ID_ASC                        125
00673 #define X509V3_F_SXNET_ADD_ID_INTEGER                    126
00674 #define X509V3_F_SXNET_ADD_ID_ULONG                      127
00675 #define X509V3_F_SXNET_GET_ID_ASC                        128
00676 #define X509V3_F_SXNET_GET_ID_ULONG                      129
00677 #define X509V3_F_V2I_ASN1_BIT_STRING                     101
00678 #define X509V3_F_V2I_AUTHORITY_INFO_ACCESS               139
00679 #define X509V3_F_V2I_AUTHORITY_KEYID                     119
00680 #define X509V3_F_V2I_BASIC_CONSTRAINTS                   102
00681 #define X509V3_F_V2I_CRLD                                134
00682 #define X509V3_F_V2I_EXTENDED_KEY_USAGE                  103
00683 #define X509V3_F_V2I_GENERAL_NAMES                       118
00684 #define X509V3_F_V2I_GENERAL_NAME_EX                     117
00685 #define X509V3_F_V2I_ISSUER_ALT                          153
00686 #define X509V3_F_V2I_NAME_CONSTRAINTS                    147
00687 #define X509V3_F_V2I_POLICY_CONSTRAINTS                  146
00688 #define X509V3_F_V2I_POLICY_MAPPINGS                     145
00689 #define X509V3_F_V2I_SUBJECT_ALT                         154
00690 #define X509V3_F_V3_GENERIC_EXTENSION                    116
00691 #define X509V3_F_X509V3_ADD1_I2D                         140
00692 #define X509V3_F_X509V3_ADD_VALUE                        105
00693 #define X509V3_F_X509V3_EXT_ADD                          104
00694 #define X509V3_F_X509V3_EXT_ADD_ALIAS                    106
00695 #define X509V3_F_X509V3_EXT_CONF                         107
00696 #define X509V3_F_X509V3_EXT_I2D                          136
00697 #define X509V3_F_X509V3_EXT_NCONF                        152
00698 #define X509V3_F_X509V3_GET_SECTION                      142
00699 #define X509V3_F_X509V3_GET_STRING                       143
00700 #define X509V3_F_X509V3_GET_VALUE_BOOL                   110
00701 #define X509V3_F_X509V3_PARSE_LIST                       109
00702 #define X509V3_F_X509_PURPOSE_ADD                        137
00703 #define X509V3_F_X509_PURPOSE_SET                        141
00704 
00705 /* Reason codes. */
00706 #define X509V3_R_BAD_IP_ADDRESS                          118
00707 #define X509V3_R_BAD_OBJECT                              119
00708 #define X509V3_R_BN_DEC2BN_ERROR                         100
00709 #define X509V3_R_BN_TO_ASN1_INTEGER_ERROR                101
00710 #define X509V3_R_DIRNAME_ERROR                           149
00711 #define X509V3_R_DUPLICATE_ZONE_ID                       133
00712 #define X509V3_R_ERROR_CONVERTING_ZONE                   131
00713 #define X509V3_R_ERROR_CREATING_EXTENSION                144
00714 #define X509V3_R_ERROR_IN_EXTENSION                      128
00715 #define X509V3_R_EXPECTED_A_SECTION_NAME                 137
00716 #define X509V3_R_EXTENSION_EXISTS                        145
00717 #define X509V3_R_EXTENSION_NAME_ERROR                    115
00718 #define X509V3_R_EXTENSION_NOT_FOUND                     102
00719 #define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED         103
00720 #define X509V3_R_EXTENSION_VALUE_ERROR                   116
00721 #define X509V3_R_ILLEGAL_EMPTY_EXTENSION                 151
00722 #define X509V3_R_ILLEGAL_HEX_DIGIT                       113
00723 #define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG             152
00724 #define X509V3_R_INVALID_BOOLEAN_STRING                  104
00725 #define X509V3_R_INVALID_EXTENSION_STRING                105
00726 #define X509V3_R_INVALID_NAME                            106
00727 #define X509V3_R_INVALID_NULL_ARGUMENT                   107
00728 #define X509V3_R_INVALID_NULL_NAME                       108
00729 #define X509V3_R_INVALID_NULL_VALUE                      109
00730 #define X509V3_R_INVALID_NUMBER                          140
00731 #define X509V3_R_INVALID_NUMBERS                         141
00732 #define X509V3_R_INVALID_OBJECT_IDENTIFIER               110
00733 #define X509V3_R_INVALID_OPTION                          138
00734 #define X509V3_R_INVALID_POLICY_IDENTIFIER               134
00735 #define X509V3_R_INVALID_PROXY_POLICY_SETTING            153
00736 #define X509V3_R_INVALID_PURPOSE                         146
00737 #define X509V3_R_INVALID_SECTION                         135
00738 #define X509V3_R_INVALID_SYNTAX                          143
00739 #define X509V3_R_ISSUER_DECODE_ERROR                     126
00740 #define X509V3_R_MISSING_VALUE                           124
00741 #define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS           142
00742 #define X509V3_R_NO_CONFIG_DATABASE                      136
00743 #define X509V3_R_NO_ISSUER_CERTIFICATE                   121
00744 #define X509V3_R_NO_ISSUER_DETAILS                       127
00745 #define X509V3_R_NO_POLICY_IDENTIFIER                    139
00746 #define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED   154
00747 #define X509V3_R_NO_PUBLIC_KEY                           114
00748 #define X509V3_R_NO_SUBJECT_DETAILS                      125
00749 #define X509V3_R_ODD_NUMBER_OF_DIGITS                    112
00750 #define X509V3_R_OPERATION_NOT_DEFINED                   148
00751 #define X509V3_R_OTHERNAME_ERROR                         147
00752 #define X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED        155
00753 #define X509V3_R_POLICY_PATH_LENGTH                      156
00754 #define X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED     157
00755 #define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED   158
00756 #define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159
00757 #define X509V3_R_SECTION_NOT_FOUND                       150
00758 #define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS            122
00759 #define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID              123
00760 #define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT             111
00761 #define X509V3_R_UNKNOWN_EXTENSION                       129
00762 #define X509V3_R_UNKNOWN_EXTENSION_NAME                  130
00763 #define X509V3_R_UNKNOWN_OPTION                          120
00764 #define X509V3_R_UNSUPPORTED_OPTION                      117
00765 #define X509V3_R_USER_TOO_LONG                           132
00766 
00767 #ifdef  __cplusplus
00768 }
00769 #endif
00770 #endif

Copyright © Nokia Corporation 2001-2008
Back to top