00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 #ifndef HEADER_X509V3_H
00059 #define HEADER_X509V3_H
00060
00061 #include <openssl/bio.h>
00062 #include <openssl/x509.h>
00063 #include <openssl/conf.h>
00064
00065 #ifdef __cplusplus
00066 extern "C" {
00067 #endif
00068
00069
00070 struct v3_ext_method;
00071 struct v3_ext_ctx;
00072
00073
00074
00075 typedef void * (*X509V3_EXT_NEW)(void);
00076 typedef void (*X509V3_EXT_FREE)(void *);
00077 typedef void * (*X509V3_EXT_D2I)(void *, const unsigned char ** , long);
00078 typedef int (*X509V3_EXT_I2D)(void *, unsigned char **);
00079 typedef STACK_OF(CONF_VALUE) * (*X509V3_EXT_I2V)(struct v3_ext_method *method, void *ext, STACK_OF(CONF_VALUE) *extlist);
00080 typedef void * (*X509V3_EXT_V2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, STACK_OF(CONF_VALUE) *values);
00081 typedef char * (*X509V3_EXT_I2S)(struct v3_ext_method *method, void *ext);
00082 typedef void * (*X509V3_EXT_S2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, const char *str);
00083 typedef int (*X509V3_EXT_I2R)(struct v3_ext_method *method, void *ext, BIO *out, int indent);
00084 typedef void * (*X509V3_EXT_R2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, const char *str);
00085
00086
00087
00088 struct v3_ext_method {
00089 int ext_nid;
00090 int ext_flags;
00091
00092 ASN1_ITEM_EXP *it;
00093
00094 X509V3_EXT_NEW ext_new;
00095 X509V3_EXT_FREE ext_free;
00096 X509V3_EXT_D2I d2i;
00097 X509V3_EXT_I2D i2d;
00098
00099
00100 X509V3_EXT_I2S i2s;
00101 X509V3_EXT_S2I s2i;
00102
00103
00104 X509V3_EXT_I2V i2v;
00105 X509V3_EXT_V2I v2i;
00106
00107
00108 X509V3_EXT_I2R i2r;
00109 X509V3_EXT_R2I r2i;
00110
00111 void *usr_data;
00112 };
00113
00114 typedef struct X509V3_CONF_METHOD_st {
00115 char * (*get_string)(void *db, char *section, char *value);
00116 STACK_OF(CONF_VALUE) * (*get_section)(void *db, char *section);
00117 void (*free_string)(void *db, char * string);
00118 void (*free_section)(void *db, STACK_OF(CONF_VALUE) *section);
00119 } X509V3_CONF_METHOD;
00120
00121
00122 struct v3_ext_ctx {
00123 #define CTX_TEST 0x1
00124 int flags;
00125 X509 *issuer_cert;
00126 X509 *subject_cert;
00127 X509_REQ *subject_req;
00128 X509_CRL *crl;
00129 X509V3_CONF_METHOD *db_meth;
00130 void *db;
00131
00132 };
00133
00134 typedef struct v3_ext_method X509V3_EXT_METHOD;
00135
00136 DECLARE_STACK_OF(X509V3_EXT_METHOD)
00137
00138
00139 #define X509V3_EXT_DYNAMIC 0x1
00140 #define X509V3_EXT_CTX_DEP 0x2
00141 #define X509V3_EXT_MULTILINE 0x4
00142
00143 typedef BIT_STRING_BITNAME ENUMERATED_NAMES;
00144
00145 typedef struct BASIC_CONSTRAINTS_st {
00146 int ca;
00147 ASN1_INTEGER *pathlen;
00148 } BASIC_CONSTRAINTS;
00149
00150
00151 typedef struct PKEY_USAGE_PERIOD_st {
00152 ASN1_GENERALIZEDTIME *notBefore;
00153 ASN1_GENERALIZEDTIME *notAfter;
00154 } PKEY_USAGE_PERIOD;
00155
00156 typedef struct otherName_st {
00157 ASN1_OBJECT *type_id;
00158 ASN1_TYPE *value;
00159 } OTHERNAME;
00160
00161 typedef struct EDIPartyName_st {
00162 ASN1_STRING *nameAssigner;
00163 ASN1_STRING *partyName;
00164 } EDIPARTYNAME;
00165
00166 typedef struct GENERAL_NAME_st {
00167
00168 #define GEN_OTHERNAME 0
00169 #define GEN_EMAIL 1
00170 #define GEN_DNS 2
00171 #define GEN_X400 3
00172 #define GEN_DIRNAME 4
00173 #define GEN_EDIPARTY 5
00174 #define GEN_URI 6
00175 #define GEN_IPADD 7
00176 #define GEN_RID 8
00177
00178 int type;
00179 union {
00180 char *ptr;
00181 OTHERNAME *otherName;
00182 ASN1_IA5STRING *rfc822Name;
00183 ASN1_IA5STRING *dNSName;
00184 ASN1_TYPE *x400Address;
00185 X509_NAME *directoryName;
00186 EDIPARTYNAME *ediPartyName;
00187 ASN1_IA5STRING *uniformResourceIdentifier;
00188 ASN1_OCTET_STRING *iPAddress;
00189 ASN1_OBJECT *registeredID;
00190
00191
00192 ASN1_OCTET_STRING *ip;
00193 X509_NAME *dirn;
00194 ASN1_IA5STRING *ia5;
00195 ASN1_OBJECT *rid;
00196 ASN1_TYPE *other;
00197 } d;
00198 } GENERAL_NAME;
00199
00200 typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES;
00201
00202 typedef struct ACCESS_DESCRIPTION_st {
00203 ASN1_OBJECT *method;
00204 GENERAL_NAME *location;
00205 } ACCESS_DESCRIPTION;
00206
00207 typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS;
00208
00209 typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE;
00210
00211 DECLARE_STACK_OF(GENERAL_NAME)
00212 DECLARE_ASN1_SET_OF(GENERAL_NAME)
00213
00214 DECLARE_STACK_OF(ACCESS_DESCRIPTION)
00215 DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION)
00216
00217 typedef struct DIST_POINT_NAME_st {
00218 int type;
00219 union {
00220 GENERAL_NAMES *fullname;
00221 STACK_OF(X509_NAME_ENTRY) *relativename;
00222 } name;
00223 } DIST_POINT_NAME;
00224
00225 typedef struct DIST_POINT_st {
00226 DIST_POINT_NAME *distpoint;
00227 ASN1_BIT_STRING *reasons;
00228 GENERAL_NAMES *CRLissuer;
00229 } DIST_POINT;
00230
00231 typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS;
00232
00233 DECLARE_STACK_OF(DIST_POINT)
00234 DECLARE_ASN1_SET_OF(DIST_POINT)
00235
00236 typedef struct AUTHORITY_KEYID_st {
00237 ASN1_OCTET_STRING *keyid;
00238 GENERAL_NAMES *issuer;
00239 ASN1_INTEGER *serial;
00240 } AUTHORITY_KEYID;
00241
00242
00243
00244 typedef struct SXNET_ID_st {
00245 ASN1_INTEGER *zone;
00246 ASN1_OCTET_STRING *user;
00247 } SXNETID;
00248
00249 DECLARE_STACK_OF(SXNETID)
00250 DECLARE_ASN1_SET_OF(SXNETID)
00251
00252 typedef struct SXNET_st {
00253 ASN1_INTEGER *version;
00254 STACK_OF(SXNETID) *ids;
00255 } SXNET;
00256
00257 typedef struct NOTICEREF_st {
00258 ASN1_STRING *organization;
00259 STACK_OF(ASN1_INTEGER) *noticenos;
00260 } NOTICEREF;
00261
00262 typedef struct USERNOTICE_st {
00263 NOTICEREF *noticeref;
00264 ASN1_STRING *exptext;
00265 } USERNOTICE;
00266
00267 typedef struct POLICYQUALINFO_st {
00268 ASN1_OBJECT *pqualid;
00269 union {
00270 ASN1_IA5STRING *cpsuri;
00271 USERNOTICE *usernotice;
00272 ASN1_TYPE *other;
00273 } d;
00274 } POLICYQUALINFO;
00275
00276 DECLARE_STACK_OF(POLICYQUALINFO)
00277 DECLARE_ASN1_SET_OF(POLICYQUALINFO)
00278
00279 typedef struct POLICYINFO_st {
00280 ASN1_OBJECT *policyid;
00281 STACK_OF(POLICYQUALINFO) *qualifiers;
00282 } POLICYINFO;
00283
00284 typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES;
00285
00286 DECLARE_STACK_OF(POLICYINFO)
00287 DECLARE_ASN1_SET_OF(POLICYINFO)
00288
00289 typedef struct POLICY_MAPPING_st {
00290 ASN1_OBJECT *issuerDomainPolicy;
00291 ASN1_OBJECT *subjectDomainPolicy;
00292 } POLICY_MAPPING;
00293
00294 DECLARE_STACK_OF(POLICY_MAPPING)
00295
00296 typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS;
00297
00298 typedef struct GENERAL_SUBTREE_st {
00299 GENERAL_NAME *base;
00300 ASN1_INTEGER *minimum;
00301 ASN1_INTEGER *maximum;
00302 } GENERAL_SUBTREE;
00303
00304 DECLARE_STACK_OF(GENERAL_SUBTREE)
00305
00306 typedef struct NAME_CONSTRAINTS_st {
00307 STACK_OF(GENERAL_SUBTREE) *permittedSubtrees;
00308 STACK_OF(GENERAL_SUBTREE) *excludedSubtrees;
00309 } NAME_CONSTRAINTS;
00310
00311 typedef struct POLICY_CONSTRAINTS_st {
00312 ASN1_INTEGER *requireExplicitPolicy;
00313 ASN1_INTEGER *inhibitPolicyMapping;
00314 } POLICY_CONSTRAINTS;
00315
00316
00317 typedef struct PROXY_POLICY_st
00318 {
00319 ASN1_OBJECT *policyLanguage;
00320 ASN1_OCTET_STRING *policy;
00321 } PROXY_POLICY;
00322
00323 typedef struct PROXY_CERT_INFO_EXTENSION_st
00324 {
00325 ASN1_INTEGER *pcPathLengthConstraint;
00326 PROXY_POLICY *proxyPolicy;
00327 } PROXY_CERT_INFO_EXTENSION;
00328
00329 DECLARE_ASN1_FUNCTIONS(PROXY_POLICY)
00330 DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION)
00331
00332
00333 #define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \
00334 ",name:", val->name, ",value:", val->value);
00335
00336 #define X509V3_set_ctx_test(ctx) \
00337 X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST)
00338 #define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL;
00339
00340 #define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \
00341 0,0,0,0, \
00342 0,0, \
00343 (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \
00344 (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \
00345 NULL, NULL, \
00346 table}
00347
00348 #define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \
00349 0,0,0,0, \
00350 (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \
00351 (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \
00352 0,0,0,0, \
00353 NULL}
00354
00355 #define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
00356
00357
00358
00359
00360 #define EXFLAG_BCONS 0x1
00361 #define EXFLAG_KUSAGE 0x2
00362 #define EXFLAG_XKUSAGE 0x4
00363 #define EXFLAG_NSCERT 0x8
00364
00365 #define EXFLAG_CA 0x10
00366 #define EXFLAG_SS 0x20
00367 #define EXFLAG_V1 0x40
00368 #define EXFLAG_INVALID 0x80
00369 #define EXFLAG_SET 0x100
00370 #define EXFLAG_CRITICAL 0x200
00371 #define EXFLAG_PROXY 0x400
00372
00373 #define EXFLAG_INVALID_POLICY 0x400
00374
00375 #define KU_DIGITAL_SIGNATURE 0x0080
00376 #define KU_NON_REPUDIATION 0x0040
00377 #define KU_KEY_ENCIPHERMENT 0x0020
00378 #define KU_DATA_ENCIPHERMENT 0x0010
00379 #define KU_KEY_AGREEMENT 0x0008
00380 #define KU_KEY_CERT_SIGN 0x0004
00381 #define KU_CRL_SIGN 0x0002
00382 #define KU_ENCIPHER_ONLY 0x0001
00383 #define KU_DECIPHER_ONLY 0x8000
00384
00385 #define NS_SSL_CLIENT 0x80
00386 #define NS_SSL_SERVER 0x40
00387 #define NS_SMIME 0x20
00388 #define NS_OBJSIGN 0x10
00389 #define NS_SSL_CA 0x04
00390 #define NS_SMIME_CA 0x02
00391 #define NS_OBJSIGN_CA 0x01
00392 #define NS_ANY_CA (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA)
00393
00394 #define XKU_SSL_SERVER 0x1
00395 #define XKU_SSL_CLIENT 0x2
00396 #define XKU_SMIME 0x4
00397 #define XKU_CODE_SIGN 0x8
00398 #define XKU_SGC 0x10
00399 #define XKU_OCSP_SIGN 0x20
00400 #define XKU_TIMESTAMP 0x40
00401 #define XKU_DVCS 0x80
00402
00403 #define X509_PURPOSE_DYNAMIC 0x1
00404 #define X509_PURPOSE_DYNAMIC_NAME 0x2
00405
00406 typedef struct x509_purpose_st {
00407 int purpose;
00408 int trust;
00409 int flags;
00410 int (*check_purpose)(const struct x509_purpose_st *,
00411 const X509 *, int);
00412 char *name;
00413 char *sname;
00414 void *usr_data;
00415 } X509_PURPOSE;
00416
00417 #define X509_PURPOSE_SSL_CLIENT 1
00418 #define X509_PURPOSE_SSL_SERVER 2
00419 #define X509_PURPOSE_NS_SSL_SERVER 3
00420 #define X509_PURPOSE_SMIME_SIGN 4
00421 #define X509_PURPOSE_SMIME_ENCRYPT 5
00422 #define X509_PURPOSE_CRL_SIGN 6
00423 #define X509_PURPOSE_ANY 7
00424 #define X509_PURPOSE_OCSP_HELPER 8
00425
00426 #define X509_PURPOSE_MIN 1
00427 #define X509_PURPOSE_MAX 8
00428
00429
00430
00431 #define X509V3_EXT_UNKNOWN_MASK (0xfL << 16)
00432
00433 #define X509V3_EXT_DEFAULT 0
00434
00435 #define X509V3_EXT_ERROR_UNKNOWN (1L << 16)
00436
00437 #define X509V3_EXT_PARSE_UNKNOWN (2L << 16)
00438
00439 #define X509V3_EXT_DUMP_UNKNOWN (3L << 16)
00440
00441
00442
00443 #define X509V3_ADD_OP_MASK 0xfL
00444 #define X509V3_ADD_DEFAULT 0L
00445 #define X509V3_ADD_APPEND 1L
00446 #define X509V3_ADD_REPLACE 2L
00447 #define X509V3_ADD_REPLACE_EXISTING 3L
00448 #define X509V3_ADD_KEEP_EXISTING 4L
00449 #define X509V3_ADD_DELETE 5L
00450 #define X509V3_ADD_SILENT 0x10
00451
00452 DECLARE_STACK_OF(X509_PURPOSE)
00453
00454 DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS)
00455
00456 DECLARE_ASN1_FUNCTIONS(SXNET)
00457 DECLARE_ASN1_FUNCTIONS(SXNETID)
00458
00459 int SXNET_add_id_asc(SXNET **psx, char *zone, char *user, int userlen);
00460 int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, char *user, int userlen);
00461 int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, char *user, int userlen);
00462
00463 ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, char *zone);
00464 ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone);
00465 ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone);
00466
00467 DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID)
00468
00469 DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD)
00470
00471 DECLARE_ASN1_FUNCTIONS(GENERAL_NAME)
00472
00473
00474 ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
00475 X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
00476 STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
00477 ASN1_BIT_STRING *bits,
00478 STACK_OF(CONF_VALUE) *extlist);
00479
00480 STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, GENERAL_NAME *gen, STACK_OF(CONF_VALUE) *ret);
00481 int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen);
00482
00483 DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES)
00484
00485 STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method,
00486 GENERAL_NAMES *gen, STACK_OF(CONF_VALUE) *extlist);
00487 GENERAL_NAMES *v2i_GENERAL_NAMES(X509V3_EXT_METHOD *method,
00488 X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
00489
00490 DECLARE_ASN1_FUNCTIONS(OTHERNAME)
00491 DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME)
00492
00493 char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5);
00494 ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *str);
00495
00496 DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE)
00497 int i2a_ACCESS_DESCRIPTION(BIO *bp, ACCESS_DESCRIPTION* a);
00498
00499 DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES)
00500 DECLARE_ASN1_FUNCTIONS(POLICYINFO)
00501 DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO)
00502 DECLARE_ASN1_FUNCTIONS(USERNOTICE)
00503 DECLARE_ASN1_FUNCTIONS(NOTICEREF)
00504
00505 DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS)
00506 DECLARE_ASN1_FUNCTIONS(DIST_POINT)
00507 DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME)
00508
00509 DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION)
00510 DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS)
00511
00512 DECLARE_ASN1_ITEM(POLICY_MAPPING)
00513 DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING)
00514 DECLARE_ASN1_ITEM(POLICY_MAPPINGS)
00515
00516 DECLARE_ASN1_ITEM(GENERAL_SUBTREE)
00517 DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE)
00518
00519 DECLARE_ASN1_ITEM(NAME_CONSTRAINTS)
00520 DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)
00521
00522 DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS)
00523 DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS)
00524
00525 #ifdef HEADER_CONF_H
00526 GENERAL_NAME *v2i_GENERAL_NAME(X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
00527 CONF_VALUE *cnf);
00528 GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, X509V3_EXT_METHOD *method,
00529 X509V3_CTX *ctx, CONF_VALUE *cnf, int is_nc);
00530 void X509V3_conf_free(CONF_VALUE *val);
00531
00532 X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, char *value);
00533 X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, char *name, char *value);
00534 int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, char *section, STACK_OF(X509_EXTENSION) **sk);
00535 int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509 *cert);
00536 int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_REQ *req);
00537 int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl);
00538
00539 X509_EXTENSION *X509V3_EXT_conf_nid(LHASH *conf, X509V3_CTX *ctx, int ext_nid, char *value);
00540 X509_EXTENSION *X509V3_EXT_conf(LHASH *conf, X509V3_CTX *ctx, char *name, char *value);
00541 int X509V3_EXT_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509 *cert);
00542 int X509V3_EXT_REQ_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509_REQ *req);
00543 int X509V3_EXT_CRL_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl);
00544
00545 int X509V3_add_value_bool_nf(char *name, int asn1_bool,
00546 STACK_OF(CONF_VALUE) **extlist);
00547 int X509V3_get_value_bool(CONF_VALUE *value, int *asn1_bool);
00548 int X509V3_get_value_int(CONF_VALUE *value, ASN1_INTEGER **aint);
00549 void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf);
00550 void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH *lhash);
00551 #endif
00552
00553 char * X509V3_get_string(X509V3_CTX *ctx, char *name, char *section);
00554 STACK_OF(CONF_VALUE) * X509V3_get_section(X509V3_CTX *ctx, char *section);
00555 void X509V3_string_free(X509V3_CTX *ctx, char *str);
00556 void X509V3_section_free( X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section);
00557 void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject,
00558 X509_REQ *req, X509_CRL *crl, int flags);
00559
00560 int X509V3_add_value(const char *name, const char *value,
00561 STACK_OF(CONF_VALUE) **extlist);
00562 int X509V3_add_value_uchar(const char *name, const unsigned char *value,
00563 STACK_OF(CONF_VALUE) **extlist);
00564 int X509V3_add_value_bool(const char *name, int asn1_bool,
00565 STACK_OF(CONF_VALUE) **extlist);
00566 int X509V3_add_value_int(const char *name, ASN1_INTEGER *aint,
00567 STACK_OF(CONF_VALUE) **extlist);
00568 char * i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint);
00569 ASN1_INTEGER * s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, char *value);
00570 char * i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint);
00571 char * i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint);
00572 int X509V3_EXT_add(X509V3_EXT_METHOD *ext);
00573 int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist);
00574 int X509V3_EXT_add_alias(int nid_to, int nid_from);
00575 void X509V3_EXT_cleanup(void);
00576
00577 X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext);
00578 X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid);
00579 int X509V3_add_standard_extensions(void);
00580 STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line);
00581 void *X509V3_EXT_d2i(X509_EXTENSION *ext);
00582 void *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit, int *idx);
00583
00584
00585 X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc);
00586 int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, int crit, unsigned long flags);
00587
00588 char *hex_to_string(unsigned char *buffer, long len);
00589 unsigned char *string_to_hex(char *str, long *len);
00590 int name_cmp(const char *name, const char *cmp);
00591
00592 void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent,
00593 int ml);
00594 int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int indent);
00595 int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent);
00596
00597 int X509V3_extensions_print(BIO *out, char *title, STACK_OF(X509_EXTENSION) *exts, unsigned long flag, int indent);
00598
00599 int X509_check_ca(X509 *x);
00600 int X509_check_purpose(X509 *x, int id, int ca);
00601 int X509_supported_extension(X509_EXTENSION *ex);
00602 int X509_PURPOSE_set(int *p, int purpose);
00603 int X509_check_issued(X509 *issuer, X509 *subject);
00604 int X509_PURPOSE_get_count(void);
00605 X509_PURPOSE * X509_PURPOSE_get0(int idx);
00606 int X509_PURPOSE_get_by_sname(char *sname);
00607 int X509_PURPOSE_get_by_id(int id);
00608 int X509_PURPOSE_add(int id, int trust, int flags,
00609 int (*ck)(const X509_PURPOSE *, const X509 *, int),
00610 char *name, char *sname, void *arg);
00611 char *X509_PURPOSE_get0_name(X509_PURPOSE *xp);
00612 char *X509_PURPOSE_get0_sname(X509_PURPOSE *xp);
00613 int X509_PURPOSE_get_trust(X509_PURPOSE *xp);
00614 void X509_PURPOSE_cleanup(void);
00615 int X509_PURPOSE_get_id(X509_PURPOSE *);
00616
00617 STACK *X509_get1_email(X509 *x);
00618 STACK *X509_REQ_get1_email(X509_REQ *x);
00619 void X509_email_free(STACK *sk);
00620
00621 ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc);
00622 ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc);
00623 int a2i_ipadd(unsigned char *ipout, const char *ipasc);
00624 int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE)*dn_sk,
00625 unsigned long chtype);
00626
00627 void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent);
00628
00629 #ifndef OPENSSL_NO_RFC3779
00630
00631 typedef struct ASRange_st {
00632 ASN1_INTEGER *min, *max;
00633 } ASRange;
00634
00635 #define ASIdOrRange_id 0
00636 #define ASIdOrRange_range 1
00637
00638 typedef struct ASIdOrRange_st {
00639 int type;
00640 union {
00641 ASN1_INTEGER *id;
00642 ASRange *range;
00643 } u;
00644 } ASIdOrRange;
00645
00646 typedef STACK_OF(ASIdOrRange) ASIdOrRanges;
00647 DECLARE_STACK_OF(ASIdOrRange)
00648
00649 #define ASIdentifierChoice_inherit 0
00650 #define ASIdentifierChoice_asIdsOrRanges 1
00651
00652 typedef struct ASIdentifierChoice_st {
00653 int type;
00654 union {
00655 ASN1_NULL *inherit;
00656 ASIdOrRanges *asIdsOrRanges;
00657 } u;
00658 } ASIdentifierChoice;
00659
00660 typedef struct ASIdentifiers_st {
00661 ASIdentifierChoice *asnum, *rdi;
00662 } ASIdentifiers;
00663
00664 DECLARE_ASN1_FUNCTIONS(ASRange)
00665 DECLARE_ASN1_FUNCTIONS(ASIdOrRange)
00666 DECLARE_ASN1_FUNCTIONS(ASIdentifierChoice)
00667 DECLARE_ASN1_FUNCTIONS(ASIdentifiers)
00668
00669
00670 typedef struct IPAddressRange_st {
00671 ASN1_BIT_STRING *min, *max;
00672 } IPAddressRange;
00673
00674 #define IPAddressOrRange_addressPrefix 0
00675 #define IPAddressOrRange_addressRange 1
00676
00677 typedef struct IPAddressOrRange_st {
00678 int type;
00679 union {
00680 ASN1_BIT_STRING *addressPrefix;
00681 IPAddressRange *addressRange;
00682 } u;
00683 } IPAddressOrRange;
00684
00685 typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges;
00686 DECLARE_STACK_OF(IPAddressOrRange)
00687
00688 #define IPAddressChoice_inherit 0
00689 #define IPAddressChoice_addressesOrRanges 1
00690
00691 typedef struct IPAddressChoice_st {
00692 int type;
00693 union {
00694 ASN1_NULL *inherit;
00695 IPAddressOrRanges *addressesOrRanges;
00696 } u;
00697 } IPAddressChoice;
00698
00699 typedef struct IPAddressFamily_st {
00700 ASN1_OCTET_STRING *addressFamily;
00701 IPAddressChoice *ipAddressChoice;
00702 } IPAddressFamily;
00703
00704 typedef STACK_OF(IPAddressFamily) IPAddrBlocks;
00705 DECLARE_STACK_OF(IPAddressFamily)
00706
00707 DECLARE_ASN1_FUNCTIONS(IPAddressRange)
00708 DECLARE_ASN1_FUNCTIONS(IPAddressOrRange)
00709 DECLARE_ASN1_FUNCTIONS(IPAddressChoice)
00710 DECLARE_ASN1_FUNCTIONS(IPAddressFamily)
00711
00712
00713
00714
00715 #define V3_ASID_ASNUM 0
00716 #define V3_ASID_RDI 1
00717
00718
00719
00720
00721
00722
00723
00724 #define IANA_AFI_IPV4 1
00725 #define IANA_AFI_IPV6 2
00726
00727
00728
00729
00730
00731
00732 int v3_asid_add_inherit(ASIdentifiers *asid, int which);
00733 int v3_asid_add_id_or_range(ASIdentifiers *asid, int which,
00734 ASN1_INTEGER *min, ASN1_INTEGER *max);
00735 int v3_addr_add_inherit(IPAddrBlocks *addr,
00736 const unsigned afi, const unsigned *safi);
00737 int v3_addr_add_prefix(IPAddrBlocks *addr,
00738 const unsigned afi, const unsigned *safi,
00739 unsigned char *a, const int prefixlen);
00740 int v3_addr_add_range(IPAddrBlocks *addr,
00741 const unsigned afi, const unsigned *safi,
00742 unsigned char *min, unsigned char *max);
00743 unsigned v3_addr_get_afi(const IPAddressFamily *f);
00744 int v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi,
00745 unsigned char *min, unsigned char *max,
00746 const int length);
00747
00748
00749
00750
00751 int v3_asid_is_canonical(ASIdentifiers *asid);
00752 int v3_addr_is_canonical(IPAddrBlocks *addr);
00753 int v3_asid_canonize(ASIdentifiers *asid);
00754 int v3_addr_canonize(IPAddrBlocks *addr);
00755
00756
00757
00758
00759 int v3_asid_inherits(ASIdentifiers *asid);
00760 int v3_addr_inherits(IPAddrBlocks *addr);
00761 int v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b);
00762 int v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b);
00763
00764
00765
00766
00767 int v3_asid_validate_path(X509_STORE_CTX *);
00768 int v3_addr_validate_path(X509_STORE_CTX *);
00769 int v3_asid_validate_resource_set(STACK_OF(X509) *chain,
00770 ASIdentifiers *ext,
00771 int allow_inheritance);
00772 int v3_addr_validate_resource_set(STACK_OF(X509) *chain,
00773 IPAddrBlocks *ext,
00774 int allow_inheritance);
00775
00776 #endif
00777
00778
00779
00780
00781
00782 void ERR_load_X509V3_strings(void);
00783
00784
00785
00786
00787 #define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 156
00788 #define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 157
00789 #define X509V3_F_COPY_EMAIL 122
00790 #define X509V3_F_COPY_ISSUER 123
00791 #define X509V3_F_DO_DIRNAME 144
00792 #define X509V3_F_DO_EXT_CONF 124
00793 #define X509V3_F_DO_EXT_I2D 135
00794 #define X509V3_F_DO_EXT_NCONF 151
00795 #define X509V3_F_DO_I2V_NAME_CONSTRAINTS 148
00796 #define X509V3_F_HEX_TO_STRING 111
00797 #define X509V3_F_I2S_ASN1_ENUMERATED 121
00798 #define X509V3_F_I2S_ASN1_IA5STRING 149
00799 #define X509V3_F_I2S_ASN1_INTEGER 120
00800 #define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138
00801 #define X509V3_F_NOTICE_SECTION 132
00802 #define X509V3_F_NREF_NOS 133
00803 #define X509V3_F_POLICY_SECTION 131
00804 #define X509V3_F_PROCESS_PCI_VALUE 150
00805 #define X509V3_F_R2I_CERTPOL 130
00806 #define X509V3_F_R2I_PCI 155
00807 #define X509V3_F_S2I_ASN1_IA5STRING 100
00808 #define X509V3_F_S2I_ASN1_INTEGER 108
00809 #define X509V3_F_S2I_ASN1_OCTET_STRING 112
00810 #define X509V3_F_S2I_ASN1_SKEY_ID 114
00811 #define X509V3_F_S2I_SKEY_ID 115
00812 #define X509V3_F_STRING_TO_HEX 113
00813 #define X509V3_F_SXNET_ADD_ID_ASC 125
00814 #define X509V3_F_SXNET_ADD_ID_INTEGER 126
00815 #define X509V3_F_SXNET_ADD_ID_ULONG 127
00816 #define X509V3_F_SXNET_GET_ID_ASC 128
00817 #define X509V3_F_SXNET_GET_ID_ULONG 129
00818 #define X509V3_F_V2I_ASIDENTIFIERS 158
00819 #define X509V3_F_V2I_ASN1_BIT_STRING 101
00820 #define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139
00821 #define X509V3_F_V2I_AUTHORITY_KEYID 119
00822 #define X509V3_F_V2I_BASIC_CONSTRAINTS 102
00823 #define X509V3_F_V2I_CRLD 134
00824 #define X509V3_F_V2I_EXTENDED_KEY_USAGE 103
00825 #define X509V3_F_V2I_GENERAL_NAMES 118
00826 #define X509V3_F_V2I_GENERAL_NAME_EX 117
00827 #define X509V3_F_V2I_IPADDRBLOCKS 159
00828 #define X509V3_F_V2I_ISSUER_ALT 153
00829 #define X509V3_F_V2I_NAME_CONSTRAINTS 147
00830 #define X509V3_F_V2I_POLICY_CONSTRAINTS 146
00831 #define X509V3_F_V2I_POLICY_MAPPINGS 145
00832 #define X509V3_F_V2I_SUBJECT_ALT 154
00833 #define X509V3_F_V3_ADDR_VALIDATE_PATH_INTERNAL 160
00834 #define X509V3_F_V3_GENERIC_EXTENSION 116
00835 #define X509V3_F_X509V3_ADD1_I2D 140
00836 #define X509V3_F_X509V3_ADD_VALUE 105
00837 #define X509V3_F_X509V3_EXT_ADD 104
00838 #define X509V3_F_X509V3_EXT_ADD_ALIAS 106
00839 #define X509V3_F_X509V3_EXT_CONF 107
00840 #define X509V3_F_X509V3_EXT_I2D 136
00841 #define X509V3_F_X509V3_EXT_NCONF 152
00842 #define X509V3_F_X509V3_GET_SECTION 142
00843 #define X509V3_F_X509V3_GET_STRING 143
00844 #define X509V3_F_X509V3_GET_VALUE_BOOL 110
00845 #define X509V3_F_X509V3_PARSE_LIST 109
00846 #define X509V3_F_X509_PURPOSE_ADD 137
00847 #define X509V3_F_X509_PURPOSE_SET 141
00848
00849
00850 #define X509V3_R_BAD_IP_ADDRESS 118
00851 #define X509V3_R_BAD_OBJECT 119
00852 #define X509V3_R_BN_DEC2BN_ERROR 100
00853 #define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101
00854 #define X509V3_R_DIRNAME_ERROR 149
00855 #define X509V3_R_DUPLICATE_ZONE_ID 133
00856 #define X509V3_R_ERROR_CONVERTING_ZONE 131
00857 #define X509V3_R_ERROR_CREATING_EXTENSION 144
00858 #define X509V3_R_ERROR_IN_EXTENSION 128
00859 #define X509V3_R_EXPECTED_A_SECTION_NAME 137
00860 #define X509V3_R_EXTENSION_EXISTS 145
00861 #define X509V3_R_EXTENSION_NAME_ERROR 115
00862 #define X509V3_R_EXTENSION_NOT_FOUND 102
00863 #define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103
00864 #define X509V3_R_EXTENSION_VALUE_ERROR 116
00865 #define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151
00866 #define X509V3_R_ILLEGAL_HEX_DIGIT 113
00867 #define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152
00868 #define X509V3_R_INVALID_ASNUMBER 160
00869 #define X509V3_R_INVALID_ASRANGE 161
00870 #define X509V3_R_INVALID_BOOLEAN_STRING 104
00871 #define X509V3_R_INVALID_EXTENSION_STRING 105
00872 #define X509V3_R_INVALID_INHERITANCE 162
00873 #define X509V3_R_INVALID_IPADDRESS 163
00874 #define X509V3_R_INVALID_NAME 106
00875 #define X509V3_R_INVALID_NULL_ARGUMENT 107
00876 #define X509V3_R_INVALID_NULL_NAME 108
00877 #define X509V3_R_INVALID_NULL_VALUE 109
00878 #define X509V3_R_INVALID_NUMBER 140
00879 #define X509V3_R_INVALID_NUMBERS 141
00880 #define X509V3_R_INVALID_OBJECT_IDENTIFIER 110
00881 #define X509V3_R_INVALID_OPTION 138
00882 #define X509V3_R_INVALID_POLICY_IDENTIFIER 134
00883 #define X509V3_R_INVALID_PROXY_POLICY_SETTING 153
00884 #define X509V3_R_INVALID_PURPOSE 146
00885 #define X509V3_R_INVALID_SAFI 164
00886 #define X509V3_R_INVALID_SECTION 135
00887 #define X509V3_R_INVALID_SYNTAX 143
00888 #define X509V3_R_ISSUER_DECODE_ERROR 126
00889 #define X509V3_R_MISSING_VALUE 124
00890 #define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS 142
00891 #define X509V3_R_NO_CONFIG_DATABASE 136
00892 #define X509V3_R_NO_ISSUER_CERTIFICATE 121
00893 #define X509V3_R_NO_ISSUER_DETAILS 127
00894 #define X509V3_R_NO_POLICY_IDENTIFIER 139
00895 #define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 154
00896 #define X509V3_R_NO_PUBLIC_KEY 114
00897 #define X509V3_R_NO_SUBJECT_DETAILS 125
00898 #define X509V3_R_ODD_NUMBER_OF_DIGITS 112
00899 #define X509V3_R_OPERATION_NOT_DEFINED 148
00900 #define X509V3_R_OTHERNAME_ERROR 147
00901 #define X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED 155
00902 #define X509V3_R_POLICY_PATH_LENGTH 156
00903 #define X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED 157
00904 #define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED 158
00905 #define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159
00906 #define X509V3_R_SECTION_NOT_FOUND 150
00907 #define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122
00908 #define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123
00909 #define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111
00910 #define X509V3_R_UNKNOWN_EXTENSION 129
00911 #define X509V3_R_UNKNOWN_EXTENSION_NAME 130
00912 #define X509V3_R_UNKNOWN_OPTION 120
00913 #define X509V3_R_UNSUPPORTED_OPTION 117
00914 #define X509V3_R_USER_TOO_LONG 132
00915
00916 #ifdef __cplusplus
00917 }
00918 #endif
00919 #endif