LTKCPP-- LLRP Toolkit C Plus Plus Library
x509.h
00001 /* crypto/x509/x509.h */
00002 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
00003  * All rights reserved.
00004  *
00005  * This package is an SSL implementation written
00006  * by Eric Young (eay@cryptsoft.com).
00007  * The implementation was written so as to conform with Netscapes SSL.
00008  *
00009  * This library is free for commercial and non-commercial use as long as
00010  * the following conditions are aheared to.  The following conditions
00011  * apply to all code found in this distribution, be it the RC4, RSA,
00012  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
00013  * included with this distribution is covered by the same copyright terms
00014  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
00015  *
00016  * Copyright remains Eric Young's, and as such any Copyright notices in
00017  * the code are not to be removed.
00018  * If this package is used in a product, Eric Young should be given attribution
00019  * as the author of the parts of the library used.
00020  * This can be in the form of a textual message at program startup or
00021  * in documentation (online or textual) provided with the package.
00022  *
00023  * Redistribution and use in source and binary forms, with or without
00024  * modification, are permitted provided that the following conditions
00025  * are met:
00026  * 1. Redistributions of source code must retain the copyright
00027  *    notice, this list of conditions and the following disclaimer.
00028  * 2. Redistributions in binary form must reproduce the above copyright
00029  *    notice, this list of conditions and the following disclaimer in the
00030  *    documentation and/or other materials provided with the distribution.
00031  * 3. All advertising materials mentioning features or use of this software
00032  *    must display the following acknowledgement:
00033  *    "This product includes cryptographic software written by
00034  *     Eric Young (eay@cryptsoft.com)"
00035  *    The word 'cryptographic' can be left out if the rouines from the library
00036  *    being used are not cryptographic related :-).
00037  * 4. If you include any Windows specific code (or a derivative thereof) from
00038  *    the apps directory (application code) you must include an acknowledgement:
00039  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
00040  *
00041  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
00042  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00043  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00044  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
00045  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00046  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00047  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00048  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00049  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00050  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00051  * SUCH DAMAGE.
00052  *
00053  * The licence and distribution terms for any publically available version or
00054  * derivative of this code cannot be changed.  i.e. this code cannot simply be
00055  * copied and put under another distribution licence
00056  * [including the GNU Public Licence.]
00057  */
00058 /* ====================================================================
00059  * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
00060  * ECDH support in OpenSSL originally developed by
00061  * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
00062  */
00063 
00064 #ifndef HEADER_X509_H
00065 # define HEADER_X509_H
00066 
00067 # include <openssl/e_os2.h>
00068 # include <openssl/symhacks.h>
00069 # ifndef OPENSSL_NO_BUFFER
00070 #  include <openssl/buffer.h>
00071 # endif
00072 # ifndef OPENSSL_NO_EVP
00073 #  include <openssl/evp.h>
00074 # endif
00075 # ifndef OPENSSL_NO_BIO
00076 #  include <openssl/bio.h>
00077 # endif
00078 # include <openssl/stack.h>
00079 # include <openssl/asn1.h>
00080 # include <openssl/safestack.h>
00081 
00082 # ifndef OPENSSL_NO_EC
00083 #  include <openssl/ec.h>
00084 # endif
00085 
00086 # ifndef OPENSSL_NO_ECDSA
00087 #  include <openssl/ecdsa.h>
00088 # endif
00089 
00090 # ifndef OPENSSL_NO_ECDH
00091 #  include <openssl/ecdh.h>
00092 # endif
00093 
00094 # ifndef OPENSSL_NO_DEPRECATED
00095 #  ifndef OPENSSL_NO_RSA
00096 #   include <openssl/rsa.h>
00097 #  endif
00098 #  ifndef OPENSSL_NO_DSA
00099 #   include <openssl/dsa.h>
00100 #  endif
00101 #  ifndef OPENSSL_NO_DH
00102 #   include <openssl/dh.h>
00103 #  endif
00104 # endif
00105 
00106 # ifndef OPENSSL_NO_SHA
00107 #  include <openssl/sha.h>
00108 # endif
00109 # include <openssl/ossl_typ.h>
00110 
00111 #ifdef  __cplusplus
00112 extern "C" {
00113 #endif
00114 
00115 # ifdef OPENSSL_SYS_WIN32
00116 /* Under Win32 these are defined in wincrypt.h */
00117 #  undef X509_NAME
00118 #  undef X509_CERT_PAIR
00119 #  undef X509_EXTENSIONS
00120 # endif
00121 
00122 # define X509_FILETYPE_PEM       1
00123 # define X509_FILETYPE_ASN1      2
00124 # define X509_FILETYPE_DEFAULT   3
00125 
00126 # define X509v3_KU_DIGITAL_SIGNATURE     0x0080
00127 # define X509v3_KU_NON_REPUDIATION       0x0040
00128 # define X509v3_KU_KEY_ENCIPHERMENT      0x0020
00129 # define X509v3_KU_DATA_ENCIPHERMENT     0x0010
00130 # define X509v3_KU_KEY_AGREEMENT         0x0008
00131 # define X509v3_KU_KEY_CERT_SIGN         0x0004
00132 # define X509v3_KU_CRL_SIGN              0x0002
00133 # define X509v3_KU_ENCIPHER_ONLY         0x0001
00134 # define X509v3_KU_DECIPHER_ONLY         0x8000
00135 # define X509v3_KU_UNDEF                 0xffff
00136 
00137 typedef struct X509_objects_st {
00138     int nid;
00139     int (*a2i) (void);
00140     int (*i2a) (void);
00141 } X509_OBJECTS;
00142 
00143 struct X509_algor_st {
00144     ASN1_OBJECT *algorithm;
00145     ASN1_TYPE *parameter;
00146 } /* X509_ALGOR */ ;
00147 
00148 DECLARE_ASN1_SET_OF(X509_ALGOR)
00149 
00150 typedef STACK_OF(X509_ALGOR) X509_ALGORS;
00151 
00152 typedef struct X509_val_st {
00153     ASN1_TIME *notBefore;
00154     ASN1_TIME *notAfter;
00155 } X509_VAL;
00156 
00157 struct X509_pubkey_st {
00158     X509_ALGOR *algor;
00159     ASN1_BIT_STRING *public_key;
00160     EVP_PKEY *pkey;
00161 };
00162 
00163 typedef struct X509_sig_st {
00164     X509_ALGOR *algor;
00165     ASN1_OCTET_STRING *digest;
00166 } X509_SIG;
00167 
00168 typedef struct X509_name_entry_st {
00169     ASN1_OBJECT *object;
00170     ASN1_STRING *value;
00171     int set;
00172     int size;                   /* temp variable */
00173 } X509_NAME_ENTRY;
00174 
00175 DECLARE_STACK_OF(X509_NAME_ENTRY)
00176 DECLARE_ASN1_SET_OF(X509_NAME_ENTRY)
00177 
00178 /* we always keep X509_NAMEs in 2 forms. */
00179 struct X509_name_st {
00180     STACK_OF(X509_NAME_ENTRY) *entries;
00181     int modified;               /* true if 'bytes' needs to be built */
00182 # ifndef OPENSSL_NO_BUFFER
00183     BUF_MEM *bytes;
00184 # else
00185     char *bytes;
00186 # endif
00187 /*      unsigned long hash; Keep the hash around for lookups */
00188     unsigned char *canon_enc;
00189     int canon_enclen;
00190 } /* X509_NAME */ ;
00191 
00192 DECLARE_STACK_OF(X509_NAME)
00193 
00194 # define X509_EX_V_NETSCAPE_HACK         0x8000
00195 # define X509_EX_V_INIT                  0x0001
00196 typedef struct X509_extension_st {
00197     ASN1_OBJECT *object;
00198     ASN1_BOOLEAN critical;
00199     ASN1_OCTET_STRING *value;
00200 } X509_EXTENSION;
00201 
00202 typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS;
00203 
00204 DECLARE_STACK_OF(X509_EXTENSION)
00205 DECLARE_ASN1_SET_OF(X509_EXTENSION)
00206 
00207 /* a sequence of these are used */
00208 typedef struct x509_attributes_st {
00209     ASN1_OBJECT *object;
00210     int single;                 /* 0 for a set, 1 for a single item (which is
00211                                  * wrong) */
00212     union {
00213         char *ptr;
00214         /*
00215          * 0
00216          */ STACK_OF(ASN1_TYPE) *set;
00217         /*
00218          * 1
00219          */ ASN1_TYPE *single;
00220     } value;
00221 } X509_ATTRIBUTE;
00222 
00223 DECLARE_STACK_OF(X509_ATTRIBUTE)
00224 DECLARE_ASN1_SET_OF(X509_ATTRIBUTE)
00225 
00226 typedef struct X509_req_info_st {
00227     ASN1_ENCODING enc;
00228     ASN1_INTEGER *version;
00229     X509_NAME *subject;
00230     X509_PUBKEY *pubkey;
00231     /*  d=2 hl=2 l=  0 cons: cont: 00 */
00232     STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
00233 } X509_REQ_INFO;
00234 
00235 typedef struct X509_req_st {
00236     X509_REQ_INFO *req_info;
00237     X509_ALGOR *sig_alg;
00238     ASN1_BIT_STRING *signature;
00239     int references;
00240 } X509_REQ;
00241 
00242 typedef struct x509_cinf_st {
00243     ASN1_INTEGER *version;      /* [ 0 ] default of v1 */
00244     ASN1_INTEGER *serialNumber;
00245     X509_ALGOR *signature;
00246     X509_NAME *issuer;
00247     X509_VAL *validity;
00248     X509_NAME *subject;
00249     X509_PUBKEY *key;
00250     ASN1_BIT_STRING *issuerUID; /* [ 1 ] optional in v2 */
00251     ASN1_BIT_STRING *subjectUID; /* [ 2 ] optional in v2 */
00252     STACK_OF(X509_EXTENSION) *extensions; /* [ 3 ] optional in v3 */
00253     ASN1_ENCODING enc;
00254 } X509_CINF;
00255 
00256 /*
00257  * This stuff is certificate "auxiliary info" it contains details which are
00258  * useful in certificate stores and databases. When used this is tagged onto
00259  * the end of the certificate itself
00260  */
00261 
00262 typedef struct x509_cert_aux_st {
00263     STACK_OF(ASN1_OBJECT) *trust; /* trusted uses */
00264     STACK_OF(ASN1_OBJECT) *reject; /* rejected uses */
00265     ASN1_UTF8STRING *alias;     /* "friendly name" */
00266     ASN1_OCTET_STRING *keyid;   /* key id of private key */
00267     STACK_OF(X509_ALGOR) *other; /* other unspecified info */
00268 } X509_CERT_AUX;
00269 
00270 struct x509_st {
00271     X509_CINF *cert_info;
00272     X509_ALGOR *sig_alg;
00273     ASN1_BIT_STRING *signature;
00274     int valid;
00275     int references;
00276     char *name;
00277     CRYPTO_EX_DATA ex_data;
00278     /* These contain copies of various extension values */
00279     long ex_pathlen;
00280     long ex_pcpathlen;
00281     unsigned long ex_flags;
00282     unsigned long ex_kusage;
00283     unsigned long ex_xkusage;
00284     unsigned long ex_nscert;
00285     ASN1_OCTET_STRING *skid;
00286     AUTHORITY_KEYID *akid;
00287     X509_POLICY_CACHE *policy_cache;
00288     STACK_OF(DIST_POINT) *crldp;
00289     STACK_OF(GENERAL_NAME) *altname;
00290     NAME_CONSTRAINTS *nc;
00291 # ifndef OPENSSL_NO_RFC3779
00292     STACK_OF(IPAddressFamily) *rfc3779_addr;
00293     struct ASIdentifiers_st *rfc3779_asid;
00294 # endif
00295 # ifndef OPENSSL_NO_SHA
00296     unsigned char sha1_hash[SHA_DIGEST_LENGTH];
00297 # endif
00298     X509_CERT_AUX *aux;
00299 } /* X509 */ ;
00300 
00301 DECLARE_STACK_OF(X509)
00302 DECLARE_ASN1_SET_OF(X509)
00303 
00304 /* This is used for a table of trust checking functions */
00305 
00306 typedef struct x509_trust_st {
00307     int trust;
00308     int flags;
00309     int (*check_trust) (struct x509_trust_st *, X509 *, int);
00310     char *name;
00311     int arg1;
00312     void *arg2;
00313 } X509_TRUST;
00314 
00315 DECLARE_STACK_OF(X509_TRUST)
00316 
00317 typedef struct x509_cert_pair_st {
00318     X509 *forward;
00319     X509 *reverse;
00320 } X509_CERT_PAIR;
00321 
00322 /* standard trust ids */
00323 
00324 # define X509_TRUST_DEFAULT      -1/* Only valid in purpose settings */
00325 
00326 # define X509_TRUST_COMPAT       1
00327 # define X509_TRUST_SSL_CLIENT   2
00328 # define X509_TRUST_SSL_SERVER   3
00329 # define X509_TRUST_EMAIL        4
00330 # define X509_TRUST_OBJECT_SIGN  5
00331 # define X509_TRUST_OCSP_SIGN    6
00332 # define X509_TRUST_OCSP_REQUEST 7
00333 # define X509_TRUST_TSA          8
00334 
00335 /* Keep these up to date! */
00336 # define X509_TRUST_MIN          1
00337 # define X509_TRUST_MAX          8
00338 
00339 /* trust_flags values */
00340 # define X509_TRUST_DYNAMIC      1
00341 # define X509_TRUST_DYNAMIC_NAME 2
00342 
00343 /* check_trust return codes */
00344 
00345 # define X509_TRUST_TRUSTED      1
00346 # define X509_TRUST_REJECTED     2
00347 # define X509_TRUST_UNTRUSTED    3
00348 
00349 /* Flags for X509_print_ex() */
00350 
00351 # define X509_FLAG_COMPAT                0
00352 # define X509_FLAG_NO_HEADER             1L
00353 # define X509_FLAG_NO_VERSION            (1L << 1)
00354 # define X509_FLAG_NO_SERIAL             (1L << 2)
00355 # define X509_FLAG_NO_SIGNAME            (1L << 3)
00356 # define X509_FLAG_NO_ISSUER             (1L << 4)
00357 # define X509_FLAG_NO_VALIDITY           (1L << 5)
00358 # define X509_FLAG_NO_SUBJECT            (1L << 6)
00359 # define X509_FLAG_NO_PUBKEY             (1L << 7)
00360 # define X509_FLAG_NO_EXTENSIONS         (1L << 8)
00361 # define X509_FLAG_NO_SIGDUMP            (1L << 9)
00362 # define X509_FLAG_NO_AUX                (1L << 10)
00363 # define X509_FLAG_NO_ATTRIBUTES         (1L << 11)
00364 # define X509_FLAG_NO_IDS                (1L << 12)
00365 
00366 /* Flags specific to X509_NAME_print_ex() */
00367 
00368 /* The field separator information */
00369 
00370 # define XN_FLAG_SEP_MASK        (0xf << 16)
00371 
00372 # define XN_FLAG_COMPAT          0/* Traditional SSLeay: use old
00373                                    * X509_NAME_print */
00374 # define XN_FLAG_SEP_COMMA_PLUS  (1 << 16)/* RFC2253 ,+ */
00375 # define XN_FLAG_SEP_CPLUS_SPC   (2 << 16)/* ,+ spaced: more readable */
00376 # define XN_FLAG_SEP_SPLUS_SPC   (3 << 16)/* ;+ spaced */
00377 # define XN_FLAG_SEP_MULTILINE   (4 << 16)/* One line per field */
00378 
00379 # define XN_FLAG_DN_REV          (1 << 20)/* Reverse DN order */
00380 
00381 /* How the field name is shown */
00382 
00383 # define XN_FLAG_FN_MASK         (0x3 << 21)
00384 
00385 # define XN_FLAG_FN_SN           0/* Object short name */
00386 # define XN_FLAG_FN_LN           (1 << 21)/* Object long name */
00387 # define XN_FLAG_FN_OID          (2 << 21)/* Always use OIDs */
00388 # define XN_FLAG_FN_NONE         (3 << 21)/* No field names */
00389 
00390 # define XN_FLAG_SPC_EQ          (1 << 23)/* Put spaces round '=' */
00391 
00392 /*
00393  * This determines if we dump fields we don't recognise: RFC2253 requires
00394  * this.
00395  */
00396 
00397 # define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24)
00398 
00399 # define XN_FLAG_FN_ALIGN        (1 << 25)/* Align field names to 20
00400                                            * characters */
00401 
00402 /* Complete set of RFC2253 flags */
00403 
00404 # define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \
00405                         XN_FLAG_SEP_COMMA_PLUS | \
00406                         XN_FLAG_DN_REV | \
00407                         XN_FLAG_FN_SN | \
00408                         XN_FLAG_DUMP_UNKNOWN_FIELDS)
00409 
00410 /* readable oneline form */
00411 
00412 # define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \
00413                         ASN1_STRFLGS_ESC_QUOTE | \
00414                         XN_FLAG_SEP_CPLUS_SPC | \
00415                         XN_FLAG_SPC_EQ | \
00416                         XN_FLAG_FN_SN)
00417 
00418 /* readable multiline form */
00419 
00420 # define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \
00421                         ASN1_STRFLGS_ESC_MSB | \
00422                         XN_FLAG_SEP_MULTILINE | \
00423                         XN_FLAG_SPC_EQ | \
00424                         XN_FLAG_FN_LN | \
00425                         XN_FLAG_FN_ALIGN)
00426 
00427 struct x509_revoked_st {
00428     ASN1_INTEGER *serialNumber;
00429     ASN1_TIME *revocationDate;
00430     STACK_OF(X509_EXTENSION) /* optional */ *extensions;
00431     /* Set up if indirect CRL */
00432     STACK_OF(GENERAL_NAME) *issuer;
00433     /* Revocation reason */
00434     int reason;
00435     int sequence;               /* load sequence */
00436 };
00437 
00438 DECLARE_STACK_OF(X509_REVOKED)
00439 DECLARE_ASN1_SET_OF(X509_REVOKED)
00440 
00441 typedef struct X509_crl_info_st {
00442     ASN1_INTEGER *version;
00443     X509_ALGOR *sig_alg;
00444     X509_NAME *issuer;
00445     ASN1_TIME *lastUpdate;
00446     ASN1_TIME *nextUpdate;
00447     STACK_OF(X509_REVOKED) *revoked;
00448     STACK_OF(X509_EXTENSION) /* [0] */ *extensions;
00449     ASN1_ENCODING enc;
00450 } X509_CRL_INFO;
00451 
00452 struct X509_crl_st {
00453     /* actual signature */
00454     X509_CRL_INFO *crl;
00455     X509_ALGOR *sig_alg;
00456     ASN1_BIT_STRING *signature;
00457     int references;
00458     int flags;
00459     /* Copies of various extensions */
00460     AUTHORITY_KEYID *akid;
00461     ISSUING_DIST_POINT *idp;
00462     /* Convenient breakdown of IDP */
00463     int idp_flags;
00464     int idp_reasons;
00465     /* CRL and base CRL numbers for delta processing */
00466     ASN1_INTEGER *crl_number;
00467     ASN1_INTEGER *base_crl_number;
00468 # ifndef OPENSSL_NO_SHA
00469     unsigned char sha1_hash[SHA_DIGEST_LENGTH];
00470 # endif
00471     STACK_OF(GENERAL_NAMES) *issuers;
00472     const X509_CRL_METHOD *meth;
00473     void *meth_data;
00474 } /* X509_CRL */ ;
00475 
00476 DECLARE_STACK_OF(X509_CRL)
00477 DECLARE_ASN1_SET_OF(X509_CRL)
00478 
00479 typedef struct private_key_st {
00480     int version;
00481     /* The PKCS#8 data types */
00482     X509_ALGOR *enc_algor;
00483     ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */
00484     /* When decrypted, the following will not be NULL */
00485     EVP_PKEY *dec_pkey;
00486     /* used to encrypt and decrypt */
00487     int key_length;
00488     char *key_data;
00489     int key_free;               /* true if we should auto free key_data */
00490     /* expanded version of 'enc_algor' */
00491     EVP_CIPHER_INFO cipher;
00492     int references;
00493 } X509_PKEY;
00494 
00495 # ifndef OPENSSL_NO_EVP
00496 typedef struct X509_info_st {
00497     X509 *x509;
00498     X509_CRL *crl;
00499     X509_PKEY *x_pkey;
00500     EVP_CIPHER_INFO enc_cipher;
00501     int enc_len;
00502     char *enc_data;
00503     int references;
00504 } X509_INFO;
00505 
00506 DECLARE_STACK_OF(X509_INFO)
00507 # endif
00508 
00509 /*
00510  * The next 2 structures and their 8 routines were sent to me by Pat Richard
00511  * <patr@x509.com> and are used to manipulate Netscapes spki structures -
00512  * useful if you are writing a CA web page
00513  */
00514 typedef struct Netscape_spkac_st {
00515     X509_PUBKEY *pubkey;
00516     ASN1_IA5STRING *challenge;  /* challenge sent in atlas >= PR2 */
00517 } NETSCAPE_SPKAC;
00518 
00519 typedef struct Netscape_spki_st {
00520     NETSCAPE_SPKAC *spkac;      /* signed public key and challenge */
00521     X509_ALGOR *sig_algor;
00522     ASN1_BIT_STRING *signature;
00523 } NETSCAPE_SPKI;
00524 
00525 /* Netscape certificate sequence structure */
00526 typedef struct Netscape_certificate_sequence {
00527     ASN1_OBJECT *type;
00528     STACK_OF(X509) *certs;
00529 } NETSCAPE_CERT_SEQUENCE;
00530 
00531 /*- Unused (and iv length is wrong)
00532 typedef struct CBCParameter_st
00533         {
00534         unsigned char iv[8];
00535         } CBC_PARAM;
00536 */
00537 
00538 /* Password based encryption structure */
00539 
00540 typedef struct PBEPARAM_st {
00541     ASN1_OCTET_STRING *salt;
00542     ASN1_INTEGER *iter;
00543 } PBEPARAM;
00544 
00545 /* Password based encryption V2 structures */
00546 
00547 typedef struct PBE2PARAM_st {
00548     X509_ALGOR *keyfunc;
00549     X509_ALGOR *encryption;
00550 } PBE2PARAM;
00551 
00552 typedef struct PBKDF2PARAM_st {
00553 /* Usually OCTET STRING but could be anything */
00554     ASN1_TYPE *salt;
00555     ASN1_INTEGER *iter;
00556     ASN1_INTEGER *keylength;
00557     X509_ALGOR *prf;
00558 } PBKDF2PARAM;
00559 
00560 /* PKCS#8 private key info structure */
00561 
00562 struct pkcs8_priv_key_info_st {
00563     /* Flag for various broken formats */
00564     int broken;
00565 # define PKCS8_OK                0
00566 # define PKCS8_NO_OCTET          1
00567 # define PKCS8_EMBEDDED_PARAM    2
00568 # define PKCS8_NS_DB             3
00569 # define PKCS8_NEG_PRIVKEY       4
00570     ASN1_INTEGER *version;
00571     X509_ALGOR *pkeyalg;
00572     /* Should be OCTET STRING but some are broken */
00573     ASN1_TYPE *pkey;
00574     STACK_OF(X509_ATTRIBUTE) *attributes;
00575 };
00576 
00577 #ifdef  __cplusplus
00578 }
00579 #endif
00580 
00581 # include <openssl/x509_vfy.h>
00582 # include <openssl/pkcs7.h>
00583 
00584 #ifdef  __cplusplus
00585 extern "C" {
00586 #endif
00587 
00588 # define X509_EXT_PACK_UNKNOWN   1
00589 # define X509_EXT_PACK_STRING    2
00590 
00591 # define         X509_get_version(x) ASN1_INTEGER_get((x)->cert_info->version)
00592 /* #define      X509_get_serialNumber(x) ((x)->cert_info->serialNumber) */
00593 # define         X509_get_notBefore(x) ((x)->cert_info->validity->notBefore)
00594 # define         X509_get_notAfter(x) ((x)->cert_info->validity->notAfter)
00595 # define         X509_extract_key(x)     X509_get_pubkey(x)/*****/
00596 # define         X509_REQ_get_version(x) ASN1_INTEGER_get((x)->req_info->version)
00597 # define         X509_REQ_get_subject_name(x) ((x)->req_info->subject)
00598 # define         X509_REQ_extract_key(a) X509_REQ_get_pubkey(a)
00599 # define         X509_name_cmp(a,b)      X509_NAME_cmp((a),(b))
00600 # define         X509_get_signature_type(x) EVP_PKEY_type(OBJ_obj2nid((x)->sig_alg->algorithm))
00601 
00602 # define         X509_CRL_get_version(x) ASN1_INTEGER_get((x)->crl->version)
00603 # define         X509_CRL_get_lastUpdate(x) ((x)->crl->lastUpdate)
00604 # define         X509_CRL_get_nextUpdate(x) ((x)->crl->nextUpdate)
00605 # define         X509_CRL_get_issuer(x) ((x)->crl->issuer)
00606 # define         X509_CRL_get_REVOKED(x) ((x)->crl->revoked)
00607 
00608 void X509_CRL_set_default_method(const X509_CRL_METHOD *meth);
00609 X509_CRL_METHOD *X509_CRL_METHOD_new(int (*crl_init) (X509_CRL *crl),
00610                                      int (*crl_free) (X509_CRL *crl),
00611                                      int (*crl_lookup) (X509_CRL *crl,
00612                                                         X509_REVOKED **ret,
00613                                                         ASN1_INTEGER *ser,
00614                                                         X509_NAME *issuer),
00615                                      int (*crl_verify) (X509_CRL *crl,
00616                                                         EVP_PKEY *pk));
00617 void X509_CRL_METHOD_free(X509_CRL_METHOD *m);
00618 
00619 void X509_CRL_set_meth_data(X509_CRL *crl, void *dat);
00620 void *X509_CRL_get_meth_data(X509_CRL *crl);
00621 
00622 /*
00623  * This one is only used so that a binary form can output, as in
00624  * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf)
00625  */
00626 # define         X509_get_X509_PUBKEY(x) ((x)->cert_info->key)
00627 
00628 const char *X509_verify_cert_error_string(long n);
00629 
00630 # ifndef OPENSSL_NO_EVP
00631 int X509_verify(X509 *a, EVP_PKEY *r);
00632 
00633 int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r);
00634 int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r);
00635 int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r);
00636 
00637 NETSCAPE_SPKI *NETSCAPE_SPKI_b64_decode(const char *str, int len);
00638 char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x);
00639 EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x);
00640 int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey);
00641 
00642 int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki);
00643 
00644 int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent);
00645 int X509_signature_print(BIO *bp, X509_ALGOR *alg, ASN1_STRING *sig);
00646 
00647 int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
00648 int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx);
00649 int X509_http_nbio(OCSP_REQ_CTX *rctx, X509 **pcert);
00650 int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);
00651 int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx);
00652 int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);
00653 int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx);
00654 int X509_CRL_http_nbio(OCSP_REQ_CTX *rctx, X509_CRL **pcrl);
00655 int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md);
00656 
00657 int X509_pubkey_digest(const X509 *data, const EVP_MD *type,
00658                        unsigned char *md, unsigned int *len);
00659 int X509_digest(const X509 *data, const EVP_MD *type,
00660                 unsigned char *md, unsigned int *len);
00661 int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type,
00662                     unsigned char *md, unsigned int *len);
00663 int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type,
00664                     unsigned char *md, unsigned int *len);
00665 int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type,
00666                      unsigned char *md, unsigned int *len);
00667 # endif
00668 
00669 # ifndef OPENSSL_NO_FP_API
00670 X509 *d2i_X509_fp(FILE *fp, X509 **x509);
00671 int i2d_X509_fp(FILE *fp, X509 *x509);
00672 X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl);
00673 int i2d_X509_CRL_fp(FILE *fp, X509_CRL *crl);
00674 X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **req);
00675 int i2d_X509_REQ_fp(FILE *fp, X509_REQ *req);
00676 #  ifndef OPENSSL_NO_RSA
00677 RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa);
00678 int i2d_RSAPrivateKey_fp(FILE *fp, RSA *rsa);
00679 RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa);
00680 int i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa);
00681 RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa);
00682 int i2d_RSA_PUBKEY_fp(FILE *fp, RSA *rsa);
00683 #  endif
00684 #  ifndef OPENSSL_NO_DSA
00685 DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa);
00686 int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa);
00687 DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa);
00688 int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa);
00689 #  endif
00690 #  ifndef OPENSSL_NO_EC
00691 EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey);
00692 int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey);
00693 EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey);
00694 int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey);
00695 #  endif
00696 X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8);
00697 int i2d_PKCS8_fp(FILE *fp, X509_SIG *p8);
00698 PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,
00699                                                 PKCS8_PRIV_KEY_INFO **p8inf);
00700 int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, PKCS8_PRIV_KEY_INFO *p8inf);
00701 int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key);
00702 int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey);
00703 EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a);
00704 int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey);
00705 EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a);
00706 # endif
00707 
00708 # ifndef OPENSSL_NO_BIO
00709 X509 *d2i_X509_bio(BIO *bp, X509 **x509);
00710 int i2d_X509_bio(BIO *bp, X509 *x509);
00711 X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl);
00712 int i2d_X509_CRL_bio(BIO *bp, X509_CRL *crl);
00713 X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **req);
00714 int i2d_X509_REQ_bio(BIO *bp, X509_REQ *req);
00715 #  ifndef OPENSSL_NO_RSA
00716 RSA *d2i_RSAPrivateKey_bio(BIO *bp, RSA **rsa);
00717 int i2d_RSAPrivateKey_bio(BIO *bp, RSA *rsa);
00718 RSA *d2i_RSAPublicKey_bio(BIO *bp, RSA **rsa);
00719 int i2d_RSAPublicKey_bio(BIO *bp, RSA *rsa);
00720 RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa);
00721 int i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa);
00722 #  endif
00723 #  ifndef OPENSSL_NO_DSA
00724 DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa);
00725 int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa);
00726 DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa);
00727 int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa);
00728 #  endif
00729 #  ifndef OPENSSL_NO_EC
00730 EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey);
00731 int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey);
00732 EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey);
00733 int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey);
00734 #  endif
00735 X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8);
00736 int i2d_PKCS8_bio(BIO *bp, X509_SIG *p8);
00737 PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,
00738                                                  PKCS8_PRIV_KEY_INFO **p8inf);
00739 int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO *p8inf);
00740 int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key);
00741 int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey);
00742 EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a);
00743 int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey);
00744 EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a);
00745 # endif
00746 
00747 X509 *X509_dup(X509 *x509);
00748 X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa);
00749 X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex);
00750 X509_CRL *X509_CRL_dup(X509_CRL *crl);
00751 X509_REVOKED *X509_REVOKED_dup(X509_REVOKED *rev);
00752 X509_REQ *X509_REQ_dup(X509_REQ *req);
00753 X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn);
00754 int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype,
00755                     void *pval);
00756 void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval,
00757                      X509_ALGOR *algor);
00758 void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md);
00759 int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b);
00760 
00761 X509_NAME *X509_NAME_dup(X509_NAME *xn);
00762 X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne);
00763 
00764 int X509_cmp_time(const ASN1_TIME *s, time_t *t);
00765 int X509_cmp_current_time(const ASN1_TIME *s);
00766 ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *t);
00767 ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s,
00768                             int offset_day, long offset_sec, time_t *t);
00769 ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj);
00770 
00771 const char *X509_get_default_cert_area(void);
00772 const char *X509_get_default_cert_dir(void);
00773 const char *X509_get_default_cert_file(void);
00774 const char *X509_get_default_cert_dir_env(void);
00775 const char *X509_get_default_cert_file_env(void);
00776 const char *X509_get_default_private_dir(void);
00777 
00778 X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
00779 X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey);
00780 
00781 DECLARE_ASN1_FUNCTIONS(X509_ALGOR)
00782 DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS)
00783 DECLARE_ASN1_FUNCTIONS(X509_VAL)
00784 
00785 DECLARE_ASN1_FUNCTIONS(X509_PUBKEY)
00786 
00787 int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey);
00788 EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key);
00789 int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain);
00790 int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp);
00791 EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length);
00792 # ifndef OPENSSL_NO_RSA
00793 int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp);
00794 RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length);
00795 # endif
00796 # ifndef OPENSSL_NO_DSA
00797 int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp);
00798 DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, long length);
00799 # endif
00800 # ifndef OPENSSL_NO_EC
00801 int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp);
00802 EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length);
00803 # endif
00804 
00805 DECLARE_ASN1_FUNCTIONS(X509_SIG)
00806 DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO)
00807 DECLARE_ASN1_FUNCTIONS(X509_REQ)
00808 
00809 DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE)
00810 X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value);
00811 
00812 DECLARE_ASN1_FUNCTIONS(X509_EXTENSION)
00813 DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS)
00814 
00815 DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY)
00816 
00817 DECLARE_ASN1_FUNCTIONS(X509_NAME)
00818 
00819 int X509_NAME_set(X509_NAME **xn, X509_NAME *name);
00820 
00821 DECLARE_ASN1_FUNCTIONS(X509_CINF)
00822 
00823 DECLARE_ASN1_FUNCTIONS(X509)
00824 DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX)
00825 
00826 DECLARE_ASN1_FUNCTIONS(X509_CERT_PAIR)
00827 
00828 int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
00829                           CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
00830 int X509_set_ex_data(X509 *r, int idx, void *arg);
00831 void *X509_get_ex_data(X509 *r, int idx);
00832 int i2d_X509_AUX(X509 *a, unsigned char **pp);
00833 X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length);
00834 
00835 int i2d_re_X509_tbs(X509 *x, unsigned char **pp);
00836 
00837 void X509_get0_signature(ASN1_BIT_STRING **psig, X509_ALGOR **palg,
00838                          const X509 *x);
00839 int X509_get_signature_nid(const X509 *x);
00840 
00841 int X509_alias_set1(X509 *x, unsigned char *name, int len);
00842 int X509_keyid_set1(X509 *x, unsigned char *id, int len);
00843 unsigned char *X509_alias_get0(X509 *x, int *len);
00844 unsigned char *X509_keyid_get0(X509 *x, int *len);
00845 int (*X509_TRUST_set_default(int (*trust) (int, X509 *, int))) (int, X509 *,
00846                                                                 int);
00847 int X509_TRUST_set(int *t, int trust);
00848 int X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj);
00849 int X509_add1_reject_object(X509 *x, ASN1_OBJECT *obj);
00850 void X509_trust_clear(X509 *x);
00851 void X509_reject_clear(X509 *x);
00852 
00853 DECLARE_ASN1_FUNCTIONS(X509_REVOKED)
00854 DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO)
00855 DECLARE_ASN1_FUNCTIONS(X509_CRL)
00856 
00857 int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);
00858 int X509_CRL_get0_by_serial(X509_CRL *crl,
00859                             X509_REVOKED **ret, ASN1_INTEGER *serial);
00860 int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x);
00861 
00862 X509_PKEY *X509_PKEY_new(void);
00863 void X509_PKEY_free(X509_PKEY *a);
00864 int i2d_X509_PKEY(X509_PKEY *a, unsigned char **pp);
00865 X509_PKEY *d2i_X509_PKEY(X509_PKEY **a, const unsigned char **pp,
00866                          long length);
00867 
00868 DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI)
00869 DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC)
00870 DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE)
00871 
00872 # ifndef OPENSSL_NO_EVP
00873 X509_INFO *X509_INFO_new(void);
00874 void X509_INFO_free(X509_INFO *a);
00875 char *X509_NAME_oneline(X509_NAME *a, char *buf, int size);
00876 
00877 int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1,
00878                 ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey);
00879 
00880 int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,
00881                 unsigned char *md, unsigned int *len);
00882 
00883 int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1,
00884               X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
00885               char *data, EVP_PKEY *pkey, const EVP_MD *type);
00886 
00887 int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *data,
00888                      unsigned char *md, unsigned int *len);
00889 
00890 int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1,
00891                      ASN1_BIT_STRING *signature, void *data, EVP_PKEY *pkey);
00892 
00893 int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1,
00894                    X509_ALGOR *algor2, ASN1_BIT_STRING *signature, void *data,
00895                    EVP_PKEY *pkey, const EVP_MD *type);
00896 int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1,
00897                        X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
00898                        void *asn, EVP_MD_CTX *ctx);
00899 # endif
00900 
00901 int X509_set_version(X509 *x, long version);
00902 int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial);
00903 ASN1_INTEGER *X509_get_serialNumber(X509 *x);
00904 int X509_set_issuer_name(X509 *x, X509_NAME *name);
00905 X509_NAME *X509_get_issuer_name(X509 *a);
00906 int X509_set_subject_name(X509 *x, X509_NAME *name);
00907 X509_NAME *X509_get_subject_name(X509 *a);
00908 int X509_set_notBefore(X509 *x, const ASN1_TIME *tm);
00909 int X509_set_notAfter(X509 *x, const ASN1_TIME *tm);
00910 int X509_set_pubkey(X509 *x, EVP_PKEY *pkey);
00911 EVP_PKEY *X509_get_pubkey(X509 *x);
00912 ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x);
00913 int X509_certificate_type(X509 *x, EVP_PKEY *pubkey /* optional */ );
00914 
00915 int X509_REQ_set_version(X509_REQ *x, long version);
00916 int X509_REQ_set_subject_name(X509_REQ *req, X509_NAME *name);
00917 int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);
00918 EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req);
00919 int X509_REQ_extension_nid(int nid);
00920 int *X509_REQ_get_extension_nids(void);
00921 void X509_REQ_set_extension_nids(int *nids);
00922 STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req);
00923 int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts,
00924                                 int nid);
00925 int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts);
00926 int X509_REQ_get_attr_count(const X509_REQ *req);
00927 int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos);
00928 int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, ASN1_OBJECT *obj,
00929                              int lastpos);
00930 X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc);
00931 X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc);
00932 int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr);
00933 int X509_REQ_add1_attr_by_OBJ(X509_REQ *req,
00934                               const ASN1_OBJECT *obj, int type,
00935                               const unsigned char *bytes, int len);
00936 int X509_REQ_add1_attr_by_NID(X509_REQ *req,
00937                               int nid, int type,
00938                               const unsigned char *bytes, int len);
00939 int X509_REQ_add1_attr_by_txt(X509_REQ *req,
00940                               const char *attrname, int type,
00941                               const unsigned char *bytes, int len);
00942 
00943 int X509_CRL_set_version(X509_CRL *x, long version);
00944 int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);
00945 int X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm);
00946 int X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm);
00947 int X509_CRL_sort(X509_CRL *crl);
00948 
00949 int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial);
00950 int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm);
00951 
00952 X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer,
00953                         EVP_PKEY *skey, const EVP_MD *md, unsigned int flags);
00954 
00955 int X509_REQ_check_private_key(X509_REQ *x509, EVP_PKEY *pkey);
00956 
00957 int X509_check_private_key(X509 *x509, EVP_PKEY *pkey);
00958 int X509_chain_check_suiteb(int *perror_depth,
00959                             X509 *x, STACK_OF(X509) *chain,
00960                             unsigned long flags);
00961 int X509_CRL_check_suiteb(X509_CRL *crl, EVP_PKEY *pk, unsigned long flags);
00962 STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain);
00963 
00964 int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b);
00965 unsigned long X509_issuer_and_serial_hash(X509 *a);
00966 
00967 int X509_issuer_name_cmp(const X509 *a, const X509 *b);
00968 unsigned long X509_issuer_name_hash(X509 *a);
00969 
00970 int X509_subject_name_cmp(const X509 *a, const X509 *b);
00971 unsigned long X509_subject_name_hash(X509 *x);
00972 
00973 # ifndef OPENSSL_NO_MD5
00974 unsigned long X509_issuer_name_hash_old(X509 *a);
00975 unsigned long X509_subject_name_hash_old(X509 *x);
00976 # endif
00977 
00978 int X509_cmp(const X509 *a, const X509 *b);
00979 int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b);
00980 unsigned long X509_NAME_hash(X509_NAME *x);
00981 unsigned long X509_NAME_hash_old(X509_NAME *x);
00982 
00983 int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);
00984 int X509_CRL_match(const X509_CRL *a, const X509_CRL *b);
00985 # ifndef OPENSSL_NO_FP_API
00986 int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag,
00987                      unsigned long cflag);
00988 int X509_print_fp(FILE *bp, X509 *x);
00989 int X509_CRL_print_fp(FILE *bp, X509_CRL *x);
00990 int X509_REQ_print_fp(FILE *bp, X509_REQ *req);
00991 int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent,
00992                           unsigned long flags);
00993 # endif
00994 
00995 # ifndef OPENSSL_NO_BIO
00996 int X509_NAME_print(BIO *bp, X509_NAME *name, int obase);
00997 int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent,
00998                        unsigned long flags);
00999 int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflag,
01000                   unsigned long cflag);
01001 int X509_print(BIO *bp, X509 *x);
01002 int X509_ocspid_print(BIO *bp, X509 *x);
01003 int X509_CERT_AUX_print(BIO *bp, X509_CERT_AUX *x, int indent);
01004 int X509_CRL_print(BIO *bp, X509_CRL *x);
01005 int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag,
01006                       unsigned long cflag);
01007 int X509_REQ_print(BIO *bp, X509_REQ *req);
01008 # endif
01009 
01010 int X509_NAME_entry_count(X509_NAME *name);
01011 int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len);
01012 int X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj,
01013                               char *buf, int len);
01014 
01015 /*
01016  * NOTE: you should be passsing -1, not 0 as lastpos.  The functions that use
01017  * lastpos, search after that position on.
01018  */
01019 int X509_NAME_get_index_by_NID(X509_NAME *name, int nid, int lastpos);
01020 int X509_NAME_get_index_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj,
01021                                int lastpos);
01022 X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc);
01023 X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc);
01024 int X509_NAME_add_entry(X509_NAME *name, X509_NAME_ENTRY *ne,
01025                         int loc, int set);
01026 int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type,
01027                                unsigned char *bytes, int len, int loc,
01028                                int set);
01029 int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,
01030                                unsigned char *bytes, int len, int loc,
01031                                int set);
01032 X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,
01033                                                const char *field, int type,
01034                                                const unsigned char *bytes,
01035                                                int len);
01036 X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,
01037                                                int type, unsigned char *bytes,
01038                                                int len);
01039 int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type,
01040                                const unsigned char *bytes, int len, int loc,
01041                                int set);
01042 X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne,
01043                                                ASN1_OBJECT *obj, int type,
01044                                                const unsigned char *bytes,
01045                                                int len);
01046 int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, ASN1_OBJECT *obj);
01047 int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type,
01048                              const unsigned char *bytes, int len);
01049 ASN1_OBJECT *X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne);
01050 ASN1_STRING *X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne);
01051 
01052 int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x);
01053 int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x,
01054                           int nid, int lastpos);
01055 int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x,
01056                           ASN1_OBJECT *obj, int lastpos);
01057 int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x,
01058                                int crit, int lastpos);
01059 X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc);
01060 X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc);
01061 STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x,
01062                                          X509_EXTENSION *ex, int loc);
01063 
01064 int X509_get_ext_count(X509 *x);
01065 int X509_get_ext_by_NID(X509 *x, int nid, int lastpos);
01066 int X509_get_ext_by_OBJ(X509 *x, ASN1_OBJECT *obj, int lastpos);
01067 int X509_get_ext_by_critical(X509 *x, int crit, int lastpos);
01068 X509_EXTENSION *X509_get_ext(X509 *x, int loc);
01069 X509_EXTENSION *X509_delete_ext(X509 *x, int loc);
01070 int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);
01071 void *X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx);
01072 int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
01073                       unsigned long flags);
01074 
01075 int X509_CRL_get_ext_count(X509_CRL *x);
01076 int X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos);
01077 int X509_CRL_get_ext_by_OBJ(X509_CRL *x, ASN1_OBJECT *obj, int lastpos);
01078 int X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos);
01079 X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc);
01080 X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc);
01081 int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);
01082 void *X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx);
01083 int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit,
01084                           unsigned long flags);
01085 
01086 int X509_REVOKED_get_ext_count(X509_REVOKED *x);
01087 int X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos);
01088 int X509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x, ASN1_OBJECT *obj,
01089                                 int lastpos);
01090 int X509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int lastpos);
01091 X509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc);
01092 X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc);
01093 int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc);
01094 void *X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx);
01095 int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit,
01096                               unsigned long flags);
01097 
01098 X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex,
01099                                              int nid, int crit,
01100                                              ASN1_OCTET_STRING *data);
01101 X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex,
01102                                              ASN1_OBJECT *obj, int crit,
01103                                              ASN1_OCTET_STRING *data);
01104 int X509_EXTENSION_set_object(X509_EXTENSION *ex, ASN1_OBJECT *obj);
01105 int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit);
01106 int X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data);
01107 ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex);
01108 ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne);
01109 int X509_EXTENSION_get_critical(X509_EXTENSION *ex);
01110 
01111 int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x);
01112 int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid,
01113                            int lastpos);
01114 int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk,
01115                            ASN1_OBJECT *obj, int lastpos);
01116 X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc);
01117 X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc);
01118 STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x,
01119                                            X509_ATTRIBUTE *attr);
01120 STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE)
01121                                                   **x, const ASN1_OBJECT *obj,
01122                                                   int type,
01123                                                   const unsigned char *bytes,
01124                                                   int len);
01125 STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE)
01126                                                   **x, int nid, int type,
01127                                                   const unsigned char *bytes,
01128                                                   int len);
01129 STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE)
01130                                                   **x, const char *attrname,
01131                                                   int type,
01132                                                   const unsigned char *bytes,
01133                                                   int len);
01134 void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x, ASN1_OBJECT *obj,
01135                               int lastpos, int type);
01136 X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid,
01137                                              int atrtype, const void *data,
01138                                              int len);
01139 X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr,
01140                                              const ASN1_OBJECT *obj,
01141                                              int atrtype, const void *data,
01142                                              int len);
01143 X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr,
01144                                              const char *atrname, int type,
01145                                              const unsigned char *bytes,
01146                                              int len);
01147 int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj);
01148 int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype,
01149                              const void *data, int len);
01150 void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, int atrtype,
01151                                void *data);
01152 int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr);
01153 ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr);
01154 ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx);
01155 
01156 int EVP_PKEY_get_attr_count(const EVP_PKEY *key);
01157 int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos);
01158 int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, ASN1_OBJECT *obj,
01159                              int lastpos);
01160 X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc);
01161 X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc);
01162 int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr);
01163 int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key,
01164                               const ASN1_OBJECT *obj, int type,
01165                               const unsigned char *bytes, int len);
01166 int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key,
01167                               int nid, int type,
01168                               const unsigned char *bytes, int len);
01169 int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key,
01170                               const char *attrname, int type,
01171                               const unsigned char *bytes, int len);
01172 
01173 int X509_verify_cert(X509_STORE_CTX *ctx);
01174 
01175 /* lookup a cert from a X509 STACK */
01176 X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, X509_NAME *name,
01177                                      ASN1_INTEGER *serial);
01178 X509 *X509_find_by_subject(STACK_OF(X509) *sk, X509_NAME *name);
01179 
01180 DECLARE_ASN1_FUNCTIONS(PBEPARAM)
01181 DECLARE_ASN1_FUNCTIONS(PBE2PARAM)
01182 DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM)
01183 
01184 int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
01185                          const unsigned char *salt, int saltlen);
01186 
01187 X509_ALGOR *PKCS5_pbe_set(int alg, int iter,
01188                           const unsigned char *salt, int saltlen);
01189 X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
01190                            unsigned char *salt, int saltlen);
01191 X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
01192                               unsigned char *salt, int saltlen,
01193                               unsigned char *aiv, int prf_nid);
01194 
01195 X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen,
01196                              int prf_nid, int keylen);
01197 
01198 /* PKCS#8 utilities */
01199 
01200 DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)
01201 
01202 EVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8);
01203 PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey);
01204 PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken);
01205 PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken);
01206 
01207 int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj,
01208                     int version, int ptype, void *pval,
01209                     unsigned char *penc, int penclen);
01210 int PKCS8_pkey_get0(ASN1_OBJECT **ppkalg,
01211                     const unsigned char **pk, int *ppklen,
01212                     X509_ALGOR **pa, PKCS8_PRIV_KEY_INFO *p8);
01213 
01214 int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj,
01215                            int ptype, void *pval,
01216                            unsigned char *penc, int penclen);
01217 int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg,
01218                            const unsigned char **pk, int *ppklen,
01219                            X509_ALGOR **pa, X509_PUBKEY *pub);
01220 
01221 int X509_check_trust(X509 *x, int id, int flags);
01222 int X509_TRUST_get_count(void);
01223 X509_TRUST *X509_TRUST_get0(int idx);
01224 int X509_TRUST_get_by_id(int id);
01225 int X509_TRUST_add(int id, int flags, int (*ck) (X509_TRUST *, X509 *, int),
01226                    char *name, int arg1, void *arg2);
01227 void X509_TRUST_cleanup(void);
01228 int X509_TRUST_get_flags(X509_TRUST *xp);
01229 char *X509_TRUST_get0_name(X509_TRUST *xp);
01230 int X509_TRUST_get_trust(X509_TRUST *xp);
01231 
01232 /* BEGIN ERROR CODES */
01233 /*
01234  * The following lines are auto generated by the script mkerr.pl. Any changes
01235  * made after this point may be overwritten when the script is next run.
01236  */
01237 void ERR_load_X509_strings(void);
01238 
01239 /* Error codes for the X509 functions. */
01240 
01241 /* Function codes. */
01242 # define X509_F_ADD_CERT_DIR                              100
01243 # define X509_F_BY_FILE_CTRL                              101
01244 # define X509_F_CHECK_POLICY                              145
01245 # define X509_F_DIR_CTRL                                  102
01246 # define X509_F_GET_CERT_BY_SUBJECT                       103
01247 # define X509_F_NETSCAPE_SPKI_B64_DECODE                  129
01248 # define X509_F_NETSCAPE_SPKI_B64_ENCODE                  130
01249 # define X509_F_X509AT_ADD1_ATTR                          135
01250 # define X509_F_X509V3_ADD_EXT                            104
01251 # define X509_F_X509_ATTRIBUTE_CREATE_BY_NID              136
01252 # define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ              137
01253 # define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT              140
01254 # define X509_F_X509_ATTRIBUTE_GET0_DATA                  139
01255 # define X509_F_X509_ATTRIBUTE_SET1_DATA                  138
01256 # define X509_F_X509_CHECK_PRIVATE_KEY                    128
01257 # define X509_F_X509_CRL_DIFF                             105
01258 # define X509_F_X509_CRL_PRINT_FP                         147
01259 # define X509_F_X509_EXTENSION_CREATE_BY_NID              108
01260 # define X509_F_X509_EXTENSION_CREATE_BY_OBJ              109
01261 # define X509_F_X509_GET_PUBKEY_PARAMETERS                110
01262 # define X509_F_X509_LOAD_CERT_CRL_FILE                   132
01263 # define X509_F_X509_LOAD_CERT_FILE                       111
01264 # define X509_F_X509_LOAD_CRL_FILE                        112
01265 # define X509_F_X509_NAME_ADD_ENTRY                       113
01266 # define X509_F_X509_NAME_ENTRY_CREATE_BY_NID             114
01267 # define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT             131
01268 # define X509_F_X509_NAME_ENTRY_SET_OBJECT                115
01269 # define X509_F_X509_NAME_ONELINE                         116
01270 # define X509_F_X509_NAME_PRINT                           117
01271 # define X509_F_X509_PRINT_EX_FP                          118
01272 # define X509_F_X509_PUBKEY_GET                           119
01273 # define X509_F_X509_PUBKEY_SET                           120
01274 # define X509_F_X509_REQ_CHECK_PRIVATE_KEY                144
01275 # define X509_F_X509_REQ_PRINT_EX                         121
01276 # define X509_F_X509_REQ_PRINT_FP                         122
01277 # define X509_F_X509_REQ_TO_X509                          123
01278 # define X509_F_X509_STORE_ADD_CERT                       124
01279 # define X509_F_X509_STORE_ADD_CRL                        125
01280 # define X509_F_X509_STORE_CTX_GET1_ISSUER                146
01281 # define X509_F_X509_STORE_CTX_INIT                       143
01282 # define X509_F_X509_STORE_CTX_NEW                        142
01283 # define X509_F_X509_STORE_CTX_PURPOSE_INHERIT            134
01284 # define X509_F_X509_TO_X509_REQ                          126
01285 # define X509_F_X509_TRUST_ADD                            133
01286 # define X509_F_X509_TRUST_SET                            141
01287 # define X509_F_X509_VERIFY_CERT                          127
01288 
01289 /* Reason codes. */
01290 # define X509_R_AKID_MISMATCH                             110
01291 # define X509_R_BAD_X509_FILETYPE                         100
01292 # define X509_R_BASE64_DECODE_ERROR                       118
01293 # define X509_R_CANT_CHECK_DH_KEY                         114
01294 # define X509_R_CERT_ALREADY_IN_HASH_TABLE                101
01295 # define X509_R_CRL_ALREADY_DELTA                         127
01296 # define X509_R_CRL_VERIFY_FAILURE                        131
01297 # define X509_R_ERR_ASN1_LIB                              102
01298 # define X509_R_IDP_MISMATCH                              128
01299 # define X509_R_INVALID_DIRECTORY                         113
01300 # define X509_R_INVALID_FIELD_NAME                        119
01301 # define X509_R_INVALID_TRUST                             123
01302 # define X509_R_ISSUER_MISMATCH                           129
01303 # define X509_R_KEY_TYPE_MISMATCH                         115
01304 # define X509_R_KEY_VALUES_MISMATCH                       116
01305 # define X509_R_LOADING_CERT_DIR                          103
01306 # define X509_R_LOADING_DEFAULTS                          104
01307 # define X509_R_METHOD_NOT_SUPPORTED                      124
01308 # define X509_R_NEWER_CRL_NOT_NEWER                       132
01309 # define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY              105
01310 # define X509_R_NO_CRL_NUMBER                             130
01311 # define X509_R_PUBLIC_KEY_DECODE_ERROR                   125
01312 # define X509_R_PUBLIC_KEY_ENCODE_ERROR                   126
01313 # define X509_R_SHOULD_RETRY                              106
01314 # define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN        107
01315 # define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY            108
01316 # define X509_R_UNKNOWN_KEY_TYPE                          117
01317 # define X509_R_UNKNOWN_NID                               109
01318 # define X509_R_UNKNOWN_PURPOSE_ID                        121
01319 # define X509_R_UNKNOWN_TRUST_ID                          120
01320 # define X509_R_UNSUPPORTED_ALGORITHM                     111
01321 # define X509_R_WRONG_LOOKUP_TYPE                         112
01322 # define X509_R_WRONG_TYPE                                122
01323 
01324 #ifdef  __cplusplus
01325 }
01326 #endif
01327 #endif