x509.h 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305
  1. /* crypto/x509/x509.h */
  2. /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  3. * All rights reserved.
  4. *
  5. * This package is an SSL implementation written
  6. * by Eric Young (eay@cryptsoft.com).
  7. * The implementation was written so as to conform with Netscapes SSL.
  8. *
  9. * This library is free for commercial and non-commercial use as long as
  10. * the following conditions are aheared to. The following conditions
  11. * apply to all code found in this distribution, be it the RC4, RSA,
  12. * lhash, DES, etc., code; not just the SSL code. The SSL documentation
  13. * included with this distribution is covered by the same copyright terms
  14. * except that the holder is Tim Hudson (tjh@cryptsoft.com).
  15. *
  16. * Copyright remains Eric Young's, and as such any Copyright notices in
  17. * the code are not to be removed.
  18. * If this package is used in a product, Eric Young should be given attribution
  19. * as the author of the parts of the library used.
  20. * This can be in the form of a textual message at program startup or
  21. * in documentation (online or textual) provided with the package.
  22. *
  23. * Redistribution and use in source and binary forms, with or without
  24. * modification, are permitted provided that the following conditions
  25. * are met:
  26. * 1. Redistributions of source code must retain the copyright
  27. * notice, this list of conditions and the following disclaimer.
  28. * 2. Redistributions in binary form must reproduce the above copyright
  29. * notice, this list of conditions and the following disclaimer in the
  30. * documentation and/or other materials provided with the distribution.
  31. * 3. All advertising materials mentioning features or use of this software
  32. * must display the following acknowledgement:
  33. * "This product includes cryptographic software written by
  34. * Eric Young (eay@cryptsoft.com)"
  35. * The word 'cryptographic' can be left out if the rouines from the library
  36. * being used are not cryptographic related :-).
  37. * 4. If you include any Windows specific code (or a derivative thereof) from
  38. * the apps directory (application code) you must include an acknowledgement:
  39. * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
  40. *
  41. * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  42. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  43. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  44. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  45. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  46. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  47. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  48. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  49. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  50. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  51. * SUCH DAMAGE.
  52. *
  53. * The licence and distribution terms for any publically available version or
  54. * derivative of this code cannot be changed. i.e. this code cannot simply be
  55. * copied and put under another distribution licence
  56. * [including the GNU Public Licence.]
  57. */
  58. /* ====================================================================
  59. * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
  60. * ECDH support in OpenSSL originally developed by
  61. * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
  62. */
  63. #ifndef HEADER_X509_H
  64. # define HEADER_X509_H
  65. # include <openssl/e_os2.h>
  66. # include <openssl/symhacks.h>
  67. # ifndef OPENSSL_NO_BUFFER
  68. # include <openssl/buffer.h>
  69. # endif
  70. # ifndef OPENSSL_NO_EVP
  71. # include <openssl/evp.h>
  72. # endif
  73. # ifndef OPENSSL_NO_BIO
  74. # include <openssl/bio.h>
  75. # endif
  76. # include <openssl/stack.h>
  77. # include <openssl/asn1.h>
  78. # include <openssl/safestack.h>
  79. # ifndef OPENSSL_NO_EC
  80. # include <openssl/ec.h>
  81. # endif
  82. # ifndef OPENSSL_NO_ECDSA
  83. # include <openssl/ecdsa.h>
  84. # endif
  85. # ifndef OPENSSL_NO_ECDH
  86. # include <openssl/ecdh.h>
  87. # endif
  88. # ifndef OPENSSL_NO_DEPRECATED
  89. # ifndef OPENSSL_NO_RSA
  90. # include <openssl/rsa.h>
  91. # endif
  92. # ifndef OPENSSL_NO_DSA
  93. # include <openssl/dsa.h>
  94. # endif
  95. # ifndef OPENSSL_NO_DH
  96. # include <openssl/dh.h>
  97. # endif
  98. # endif
  99. # ifndef OPENSSL_NO_SHA
  100. # include <openssl/sha.h>
  101. # endif
  102. # include <openssl/ossl_typ.h>
  103. #ifdef __cplusplus
  104. extern "C" {
  105. #endif
  106. # ifdef OPENSSL_SYS_WIN32
  107. /* Under Win32 these are defined in wincrypt.h */
  108. # undef X509_NAME
  109. # undef X509_CERT_PAIR
  110. # undef X509_EXTENSIONS
  111. # endif
  112. # define X509_FILETYPE_PEM 1
  113. # define X509_FILETYPE_ASN1 2
  114. # define X509_FILETYPE_DEFAULT 3
  115. # define X509v3_KU_DIGITAL_SIGNATURE 0x0080
  116. # define X509v3_KU_NON_REPUDIATION 0x0040
  117. # define X509v3_KU_KEY_ENCIPHERMENT 0x0020
  118. # define X509v3_KU_DATA_ENCIPHERMENT 0x0010
  119. # define X509v3_KU_KEY_AGREEMENT 0x0008
  120. # define X509v3_KU_KEY_CERT_SIGN 0x0004
  121. # define X509v3_KU_CRL_SIGN 0x0002
  122. # define X509v3_KU_ENCIPHER_ONLY 0x0001
  123. # define X509v3_KU_DECIPHER_ONLY 0x8000
  124. # define X509v3_KU_UNDEF 0xffff
  125. typedef struct X509_objects_st {
  126. int nid;
  127. int (*a2i) (void);
  128. int (*i2a) (void);
  129. } X509_OBJECTS;
  130. struct X509_algor_st {
  131. ASN1_OBJECT *algorithm;
  132. ASN1_TYPE *parameter;
  133. } /* X509_ALGOR */ ;
  134. DECLARE_ASN1_SET_OF(X509_ALGOR)
  135. typedef STACK_OF(X509_ALGOR) X509_ALGORS;
  136. typedef struct X509_val_st {
  137. ASN1_TIME *notBefore;
  138. ASN1_TIME *notAfter;
  139. } X509_VAL;
  140. struct X509_pubkey_st {
  141. X509_ALGOR *algor;
  142. ASN1_BIT_STRING *public_key;
  143. EVP_PKEY *pkey;
  144. };
  145. typedef struct X509_sig_st {
  146. X509_ALGOR *algor;
  147. ASN1_OCTET_STRING *digest;
  148. } X509_SIG;
  149. typedef struct X509_name_entry_st {
  150. ASN1_OBJECT *object;
  151. ASN1_STRING *value;
  152. int set;
  153. int size; /* temp variable */
  154. } X509_NAME_ENTRY;
  155. DECLARE_STACK_OF(X509_NAME_ENTRY)
  156. DECLARE_ASN1_SET_OF(X509_NAME_ENTRY)
  157. /* we always keep X509_NAMEs in 2 forms. */
  158. struct X509_name_st {
  159. STACK_OF(X509_NAME_ENTRY) *entries;
  160. int modified; /* true if 'bytes' needs to be built */
  161. # ifndef OPENSSL_NO_BUFFER
  162. BUF_MEM *bytes;
  163. # else
  164. char *bytes;
  165. # endif
  166. /* unsigned long hash; Keep the hash around for lookups */
  167. unsigned char *canon_enc;
  168. int canon_enclen;
  169. } /* X509_NAME */ ;
  170. DECLARE_STACK_OF(X509_NAME)
  171. # define X509_EX_V_NETSCAPE_HACK 0x8000
  172. # define X509_EX_V_INIT 0x0001
  173. typedef struct X509_extension_st {
  174. ASN1_OBJECT *object;
  175. ASN1_BOOLEAN critical;
  176. ASN1_OCTET_STRING *value;
  177. } X509_EXTENSION;
  178. typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS;
  179. DECLARE_STACK_OF(X509_EXTENSION)
  180. DECLARE_ASN1_SET_OF(X509_EXTENSION)
  181. /* a sequence of these are used */
  182. typedef struct x509_attributes_st {
  183. ASN1_OBJECT *object;
  184. int single; /* 0 for a set, 1 for a single item (which is
  185. * wrong) */
  186. union {
  187. char *ptr;
  188. /*
  189. * 0
  190. */ STACK_OF(ASN1_TYPE) *set;
  191. /*
  192. * 1
  193. */ ASN1_TYPE *single;
  194. } value;
  195. } X509_ATTRIBUTE;
  196. DECLARE_STACK_OF(X509_ATTRIBUTE)
  197. DECLARE_ASN1_SET_OF(X509_ATTRIBUTE)
  198. typedef struct X509_req_info_st {
  199. ASN1_ENCODING enc;
  200. ASN1_INTEGER *version;
  201. X509_NAME *subject;
  202. X509_PUBKEY *pubkey;
  203. /* d=2 hl=2 l= 0 cons: cont: 00 */
  204. STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
  205. } X509_REQ_INFO;
  206. typedef struct X509_req_st {
  207. X509_REQ_INFO *req_info;
  208. X509_ALGOR *sig_alg;
  209. ASN1_BIT_STRING *signature;
  210. int references;
  211. } X509_REQ;
  212. typedef struct x509_cinf_st {
  213. ASN1_INTEGER *version; /* [ 0 ] default of v1 */
  214. ASN1_INTEGER *serialNumber;
  215. X509_ALGOR *signature;
  216. X509_NAME *issuer;
  217. X509_VAL *validity;
  218. X509_NAME *subject;
  219. X509_PUBKEY *key;
  220. ASN1_BIT_STRING *issuerUID; /* [ 1 ] optional in v2 */
  221. ASN1_BIT_STRING *subjectUID; /* [ 2 ] optional in v2 */
  222. STACK_OF(X509_EXTENSION) *extensions; /* [ 3 ] optional in v3 */
  223. ASN1_ENCODING enc;
  224. } X509_CINF;
  225. /*
  226. * This stuff is certificate "auxiliary info" it contains details which are
  227. * useful in certificate stores and databases. When used this is tagged onto
  228. * the end of the certificate itself
  229. */
  230. typedef struct x509_cert_aux_st {
  231. STACK_OF(ASN1_OBJECT) *trust; /* trusted uses */
  232. STACK_OF(ASN1_OBJECT) *reject; /* rejected uses */
  233. ASN1_UTF8STRING *alias; /* "friendly name" */
  234. ASN1_OCTET_STRING *keyid; /* key id of private key */
  235. STACK_OF(X509_ALGOR) *other; /* other unspecified info */
  236. } X509_CERT_AUX;
  237. struct x509_st {
  238. X509_CINF *cert_info;
  239. X509_ALGOR *sig_alg;
  240. ASN1_BIT_STRING *signature;
  241. int valid;
  242. int references;
  243. char *name;
  244. CRYPTO_EX_DATA ex_data;
  245. /* These contain copies of various extension values */
  246. long ex_pathlen;
  247. long ex_pcpathlen;
  248. unsigned long ex_flags;
  249. unsigned long ex_kusage;
  250. unsigned long ex_xkusage;
  251. unsigned long ex_nscert;
  252. ASN1_OCTET_STRING *skid;
  253. AUTHORITY_KEYID *akid;
  254. X509_POLICY_CACHE *policy_cache;
  255. STACK_OF(DIST_POINT) *crldp;
  256. STACK_OF(GENERAL_NAME) *altname;
  257. NAME_CONSTRAINTS *nc;
  258. # ifndef OPENSSL_NO_RFC3779
  259. STACK_OF(IPAddressFamily) *rfc3779_addr;
  260. struct ASIdentifiers_st *rfc3779_asid;
  261. # endif
  262. # ifndef OPENSSL_NO_SHA
  263. unsigned char sha1_hash[SHA_DIGEST_LENGTH];
  264. # endif
  265. X509_CERT_AUX *aux;
  266. } /* X509 */ ;
  267. DECLARE_STACK_OF(X509)
  268. DECLARE_ASN1_SET_OF(X509)
  269. /* This is used for a table of trust checking functions */
  270. typedef struct x509_trust_st {
  271. int trust;
  272. int flags;
  273. int (*check_trust) (struct x509_trust_st *, X509 *, int);
  274. char *name;
  275. int arg1;
  276. void *arg2;
  277. } X509_TRUST;
  278. DECLARE_STACK_OF(X509_TRUST)
  279. typedef struct x509_cert_pair_st {
  280. X509 *forward;
  281. X509 *reverse;
  282. } X509_CERT_PAIR;
  283. /* standard trust ids */
  284. # define X509_TRUST_DEFAULT -1/* Only valid in purpose settings */
  285. # define X509_TRUST_COMPAT 1
  286. # define X509_TRUST_SSL_CLIENT 2
  287. # define X509_TRUST_SSL_SERVER 3
  288. # define X509_TRUST_EMAIL 4
  289. # define X509_TRUST_OBJECT_SIGN 5
  290. # define X509_TRUST_OCSP_SIGN 6
  291. # define X509_TRUST_OCSP_REQUEST 7
  292. # define X509_TRUST_TSA 8
  293. /* Keep these up to date! */
  294. # define X509_TRUST_MIN 1
  295. # define X509_TRUST_MAX 8
  296. /* trust_flags values */
  297. # define X509_TRUST_DYNAMIC 1
  298. # define X509_TRUST_DYNAMIC_NAME 2
  299. /* check_trust return codes */
  300. # define X509_TRUST_TRUSTED 1
  301. # define X509_TRUST_REJECTED 2
  302. # define X509_TRUST_UNTRUSTED 3
  303. /* Flags for X509_print_ex() */
  304. # define X509_FLAG_COMPAT 0
  305. # define X509_FLAG_NO_HEADER 1L
  306. # define X509_FLAG_NO_VERSION (1L << 1)
  307. # define X509_FLAG_NO_SERIAL (1L << 2)
  308. # define X509_FLAG_NO_SIGNAME (1L << 3)
  309. # define X509_FLAG_NO_ISSUER (1L << 4)
  310. # define X509_FLAG_NO_VALIDITY (1L << 5)
  311. # define X509_FLAG_NO_SUBJECT (1L << 6)
  312. # define X509_FLAG_NO_PUBKEY (1L << 7)
  313. # define X509_FLAG_NO_EXTENSIONS (1L << 8)
  314. # define X509_FLAG_NO_SIGDUMP (1L << 9)
  315. # define X509_FLAG_NO_AUX (1L << 10)
  316. # define X509_FLAG_NO_ATTRIBUTES (1L << 11)
  317. /* Flags specific to X509_NAME_print_ex() */
  318. /* The field separator information */
  319. # define XN_FLAG_SEP_MASK (0xf << 16)
  320. # define XN_FLAG_COMPAT 0/* Traditional SSLeay: use old
  321. * X509_NAME_print */
  322. # define XN_FLAG_SEP_COMMA_PLUS (1 << 16)/* RFC2253 ,+ */
  323. # define XN_FLAG_SEP_CPLUS_SPC (2 << 16)/* ,+ spaced: more readable */
  324. # define XN_FLAG_SEP_SPLUS_SPC (3 << 16)/* ;+ spaced */
  325. # define XN_FLAG_SEP_MULTILINE (4 << 16)/* One line per field */
  326. # define XN_FLAG_DN_REV (1 << 20)/* Reverse DN order */
  327. /* How the field name is shown */
  328. # define XN_FLAG_FN_MASK (0x3 << 21)
  329. # define XN_FLAG_FN_SN 0/* Object short name */
  330. # define XN_FLAG_FN_LN (1 << 21)/* Object long name */
  331. # define XN_FLAG_FN_OID (2 << 21)/* Always use OIDs */
  332. # define XN_FLAG_FN_NONE (3 << 21)/* No field names */
  333. # define XN_FLAG_SPC_EQ (1 << 23)/* Put spaces round '=' */
  334. /*
  335. * This determines if we dump fields we don't recognise: RFC2253 requires
  336. * this.
  337. */
  338. # define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24)
  339. # define XN_FLAG_FN_ALIGN (1 << 25)/* Align field names to 20
  340. * characters */
  341. /* Complete set of RFC2253 flags */
  342. # define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \
  343. XN_FLAG_SEP_COMMA_PLUS | \
  344. XN_FLAG_DN_REV | \
  345. XN_FLAG_FN_SN | \
  346. XN_FLAG_DUMP_UNKNOWN_FIELDS)
  347. /* readable oneline form */
  348. # define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \
  349. ASN1_STRFLGS_ESC_QUOTE | \
  350. XN_FLAG_SEP_CPLUS_SPC | \
  351. XN_FLAG_SPC_EQ | \
  352. XN_FLAG_FN_SN)
  353. /* readable multiline form */
  354. # define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \
  355. ASN1_STRFLGS_ESC_MSB | \
  356. XN_FLAG_SEP_MULTILINE | \
  357. XN_FLAG_SPC_EQ | \
  358. XN_FLAG_FN_LN | \
  359. XN_FLAG_FN_ALIGN)
  360. struct x509_revoked_st {
  361. ASN1_INTEGER *serialNumber;
  362. ASN1_TIME *revocationDate;
  363. STACK_OF(X509_EXTENSION) /* optional */ *extensions;
  364. /* Set up if indirect CRL */
  365. STACK_OF(GENERAL_NAME) *issuer;
  366. /* Revocation reason */
  367. int reason;
  368. int sequence; /* load sequence */
  369. };
  370. DECLARE_STACK_OF(X509_REVOKED)
  371. DECLARE_ASN1_SET_OF(X509_REVOKED)
  372. typedef struct X509_crl_info_st {
  373. ASN1_INTEGER *version;
  374. X509_ALGOR *sig_alg;
  375. X509_NAME *issuer;
  376. ASN1_TIME *lastUpdate;
  377. ASN1_TIME *nextUpdate;
  378. STACK_OF(X509_REVOKED) *revoked;
  379. STACK_OF(X509_EXTENSION) /* [0] */ *extensions;
  380. ASN1_ENCODING enc;
  381. } X509_CRL_INFO;
  382. struct X509_crl_st {
  383. /* actual signature */
  384. X509_CRL_INFO *crl;
  385. X509_ALGOR *sig_alg;
  386. ASN1_BIT_STRING *signature;
  387. int references;
  388. int flags;
  389. /* Copies of various extensions */
  390. AUTHORITY_KEYID *akid;
  391. ISSUING_DIST_POINT *idp;
  392. /* Convenient breakdown of IDP */
  393. int idp_flags;
  394. int idp_reasons;
  395. /* CRL and base CRL numbers for delta processing */
  396. ASN1_INTEGER *crl_number;
  397. ASN1_INTEGER *base_crl_number;
  398. # ifndef OPENSSL_NO_SHA
  399. unsigned char sha1_hash[SHA_DIGEST_LENGTH];
  400. # endif
  401. STACK_OF(GENERAL_NAMES) *issuers;
  402. const X509_CRL_METHOD *meth;
  403. void *meth_data;
  404. } /* X509_CRL */ ;
  405. DECLARE_STACK_OF(X509_CRL)
  406. DECLARE_ASN1_SET_OF(X509_CRL)
  407. typedef struct private_key_st {
  408. int version;
  409. /* The PKCS#8 data types */
  410. X509_ALGOR *enc_algor;
  411. ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */
  412. /* When decrypted, the following will not be NULL */
  413. EVP_PKEY *dec_pkey;
  414. /* used to encrypt and decrypt */
  415. int key_length;
  416. char *key_data;
  417. int key_free; /* true if we should auto free key_data */
  418. /* expanded version of 'enc_algor' */
  419. EVP_CIPHER_INFO cipher;
  420. int references;
  421. } X509_PKEY;
  422. # ifndef OPENSSL_NO_EVP
  423. typedef struct X509_info_st {
  424. X509 *x509;
  425. X509_CRL *crl;
  426. X509_PKEY *x_pkey;
  427. EVP_CIPHER_INFO enc_cipher;
  428. int enc_len;
  429. char *enc_data;
  430. int references;
  431. } X509_INFO;
  432. DECLARE_STACK_OF(X509_INFO)
  433. # endif
  434. /*
  435. * The next 2 structures and their 8 routines were sent to me by Pat Richard
  436. * <patr@x509.com> and are used to manipulate Netscapes spki structures -
  437. * useful if you are writing a CA web page
  438. */
  439. typedef struct Netscape_spkac_st {
  440. X509_PUBKEY *pubkey;
  441. ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */
  442. } NETSCAPE_SPKAC;
  443. typedef struct Netscape_spki_st {
  444. NETSCAPE_SPKAC *spkac; /* signed public key and challenge */
  445. X509_ALGOR *sig_algor;
  446. ASN1_BIT_STRING *signature;
  447. } NETSCAPE_SPKI;
  448. /* Netscape certificate sequence structure */
  449. typedef struct Netscape_certificate_sequence {
  450. ASN1_OBJECT *type;
  451. STACK_OF(X509) *certs;
  452. } NETSCAPE_CERT_SEQUENCE;
  453. /*- Unused (and iv length is wrong)
  454. typedef struct CBCParameter_st
  455. {
  456. unsigned char iv[8];
  457. } CBC_PARAM;
  458. */
  459. /* Password based encryption structure */
  460. typedef struct PBEPARAM_st {
  461. ASN1_OCTET_STRING *salt;
  462. ASN1_INTEGER *iter;
  463. } PBEPARAM;
  464. /* Password based encryption V2 structures */
  465. typedef struct PBE2PARAM_st {
  466. X509_ALGOR *keyfunc;
  467. X509_ALGOR *encryption;
  468. } PBE2PARAM;
  469. typedef struct PBKDF2PARAM_st {
  470. /* Usually OCTET STRING but could be anything */
  471. ASN1_TYPE *salt;
  472. ASN1_INTEGER *iter;
  473. ASN1_INTEGER *keylength;
  474. X509_ALGOR *prf;
  475. } PBKDF2PARAM;
  476. /* PKCS#8 private key info structure */
  477. struct pkcs8_priv_key_info_st {
  478. /* Flag for various broken formats */
  479. int broken;
  480. # define PKCS8_OK 0
  481. # define PKCS8_NO_OCTET 1
  482. # define PKCS8_EMBEDDED_PARAM 2
  483. # define PKCS8_NS_DB 3
  484. # define PKCS8_NEG_PRIVKEY 4
  485. ASN1_INTEGER *version;
  486. X509_ALGOR *pkeyalg;
  487. /* Should be OCTET STRING but some are broken */
  488. ASN1_TYPE *pkey;
  489. STACK_OF(X509_ATTRIBUTE) *attributes;
  490. };
  491. #ifdef __cplusplus
  492. }
  493. #endif
  494. # include <openssl/x509_vfy.h>
  495. # include <openssl/pkcs7.h>
  496. #ifdef __cplusplus
  497. extern "C" {
  498. #endif
  499. # define X509_EXT_PACK_UNKNOWN 1
  500. # define X509_EXT_PACK_STRING 2
  501. # define X509_get_version(x) ASN1_INTEGER_get((x)->cert_info->version)
  502. /* #define X509_get_serialNumber(x) ((x)->cert_info->serialNumber) */
  503. # define X509_get_notBefore(x) ((x)->cert_info->validity->notBefore)
  504. # define X509_get_notAfter(x) ((x)->cert_info->validity->notAfter)
  505. # define X509_extract_key(x) X509_get_pubkey(x)/*****/
  506. # define X509_REQ_get_version(x) ASN1_INTEGER_get((x)->req_info->version)
  507. # define X509_REQ_get_subject_name(x) ((x)->req_info->subject)
  508. # define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a)
  509. # define X509_name_cmp(a,b) X509_NAME_cmp((a),(b))
  510. # define X509_get_signature_type(x) EVP_PKEY_type(OBJ_obj2nid((x)->sig_alg->algorithm))
  511. # define X509_CRL_get_version(x) ASN1_INTEGER_get((x)->crl->version)
  512. # define X509_CRL_get_lastUpdate(x) ((x)->crl->lastUpdate)
  513. # define X509_CRL_get_nextUpdate(x) ((x)->crl->nextUpdate)
  514. # define X509_CRL_get_issuer(x) ((x)->crl->issuer)
  515. # define X509_CRL_get_REVOKED(x) ((x)->crl->revoked)
  516. void X509_CRL_set_default_method(const X509_CRL_METHOD *meth);
  517. X509_CRL_METHOD *X509_CRL_METHOD_new(int (*crl_init) (X509_CRL *crl),
  518. int (*crl_free) (X509_CRL *crl),
  519. int (*crl_lookup) (X509_CRL *crl,
  520. X509_REVOKED **ret,
  521. ASN1_INTEGER *ser,
  522. X509_NAME *issuer),
  523. int (*crl_verify) (X509_CRL *crl,
  524. EVP_PKEY *pk));
  525. void X509_CRL_METHOD_free(X509_CRL_METHOD *m);
  526. void X509_CRL_set_meth_data(X509_CRL *crl, void *dat);
  527. void *X509_CRL_get_meth_data(X509_CRL *crl);
  528. /*
  529. * This one is only used so that a binary form can output, as in
  530. * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf)
  531. */
  532. # define X509_get_X509_PUBKEY(x) ((x)->cert_info->key)
  533. const char *X509_verify_cert_error_string(long n);
  534. # ifndef OPENSSL_NO_EVP
  535. int X509_verify(X509 *a, EVP_PKEY *r);
  536. int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r);
  537. int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r);
  538. int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r);
  539. NETSCAPE_SPKI *NETSCAPE_SPKI_b64_decode(const char *str, int len);
  540. char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x);
  541. EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x);
  542. int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey);
  543. int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki);
  544. int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent);
  545. int X509_signature_print(BIO *bp, X509_ALGOR *alg, ASN1_STRING *sig);
  546. int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
  547. int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx);
  548. int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);
  549. int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx);
  550. int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);
  551. int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx);
  552. int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md);
  553. int X509_pubkey_digest(const X509 *data, const EVP_MD *type,
  554. unsigned char *md, unsigned int *len);
  555. int X509_digest(const X509 *data, const EVP_MD *type,
  556. unsigned char *md, unsigned int *len);
  557. int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type,
  558. unsigned char *md, unsigned int *len);
  559. int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type,
  560. unsigned char *md, unsigned int *len);
  561. int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type,
  562. unsigned char *md, unsigned int *len);
  563. # endif
  564. # ifndef OPENSSL_NO_FP_API
  565. X509 *d2i_X509_fp(FILE *fp, X509 **x509);
  566. int i2d_X509_fp(FILE *fp, X509 *x509);
  567. X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl);
  568. int i2d_X509_CRL_fp(FILE *fp, X509_CRL *crl);
  569. X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **req);
  570. int i2d_X509_REQ_fp(FILE *fp, X509_REQ *req);
  571. # ifndef OPENSSL_NO_RSA
  572. RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa);
  573. int i2d_RSAPrivateKey_fp(FILE *fp, RSA *rsa);
  574. RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa);
  575. int i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa);
  576. RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa);
  577. int i2d_RSA_PUBKEY_fp(FILE *fp, RSA *rsa);
  578. # endif
  579. # ifndef OPENSSL_NO_DSA
  580. DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa);
  581. int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa);
  582. DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa);
  583. int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa);
  584. # endif
  585. # ifndef OPENSSL_NO_EC
  586. EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey);
  587. int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey);
  588. EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey);
  589. int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey);
  590. # endif
  591. X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8);
  592. int i2d_PKCS8_fp(FILE *fp, X509_SIG *p8);
  593. PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,
  594. PKCS8_PRIV_KEY_INFO **p8inf);
  595. int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, PKCS8_PRIV_KEY_INFO *p8inf);
  596. int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key);
  597. int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey);
  598. EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a);
  599. int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey);
  600. EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a);
  601. # endif
  602. # ifndef OPENSSL_NO_BIO
  603. X509 *d2i_X509_bio(BIO *bp, X509 **x509);
  604. int i2d_X509_bio(BIO *bp, X509 *x509);
  605. X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl);
  606. int i2d_X509_CRL_bio(BIO *bp, X509_CRL *crl);
  607. X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **req);
  608. int i2d_X509_REQ_bio(BIO *bp, X509_REQ *req);
  609. # ifndef OPENSSL_NO_RSA
  610. RSA *d2i_RSAPrivateKey_bio(BIO *bp, RSA **rsa);
  611. int i2d_RSAPrivateKey_bio(BIO *bp, RSA *rsa);
  612. RSA *d2i_RSAPublicKey_bio(BIO *bp, RSA **rsa);
  613. int i2d_RSAPublicKey_bio(BIO *bp, RSA *rsa);
  614. RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa);
  615. int i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa);
  616. # endif
  617. # ifndef OPENSSL_NO_DSA
  618. DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa);
  619. int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa);
  620. DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa);
  621. int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa);
  622. # endif
  623. # ifndef OPENSSL_NO_EC
  624. EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey);
  625. int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey);
  626. EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey);
  627. int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey);
  628. # endif
  629. X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8);
  630. int i2d_PKCS8_bio(BIO *bp, X509_SIG *p8);
  631. PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,
  632. PKCS8_PRIV_KEY_INFO **p8inf);
  633. int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO *p8inf);
  634. int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key);
  635. int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey);
  636. EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a);
  637. int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey);
  638. EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a);
  639. # endif
  640. X509 *X509_dup(X509 *x509);
  641. X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa);
  642. X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex);
  643. X509_CRL *X509_CRL_dup(X509_CRL *crl);
  644. X509_REQ *X509_REQ_dup(X509_REQ *req);
  645. X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn);
  646. int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype,
  647. void *pval);
  648. void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval,
  649. X509_ALGOR *algor);
  650. void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md);
  651. int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b);
  652. X509_NAME *X509_NAME_dup(X509_NAME *xn);
  653. X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne);
  654. int X509_cmp_time(const ASN1_TIME *s, time_t *t);
  655. int X509_cmp_current_time(const ASN1_TIME *s);
  656. ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *t);
  657. ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s,
  658. int offset_day, long offset_sec, time_t *t);
  659. ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj);
  660. const char *X509_get_default_cert_area(void);
  661. const char *X509_get_default_cert_dir(void);
  662. const char *X509_get_default_cert_file(void);
  663. const char *X509_get_default_cert_dir_env(void);
  664. const char *X509_get_default_cert_file_env(void);
  665. const char *X509_get_default_private_dir(void);
  666. X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
  667. X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey);
  668. DECLARE_ASN1_FUNCTIONS(X509_ALGOR)
  669. DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS)
  670. DECLARE_ASN1_FUNCTIONS(X509_VAL)
  671. DECLARE_ASN1_FUNCTIONS(X509_PUBKEY)
  672. int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey);
  673. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key);
  674. int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain);
  675. int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp);
  676. EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length);
  677. # ifndef OPENSSL_NO_RSA
  678. int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp);
  679. RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length);
  680. # endif
  681. # ifndef OPENSSL_NO_DSA
  682. int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp);
  683. DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, long length);
  684. # endif
  685. # ifndef OPENSSL_NO_EC
  686. int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp);
  687. EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length);
  688. # endif
  689. DECLARE_ASN1_FUNCTIONS(X509_SIG)
  690. DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO)
  691. DECLARE_ASN1_FUNCTIONS(X509_REQ)
  692. DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE)
  693. X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value);
  694. DECLARE_ASN1_FUNCTIONS(X509_EXTENSION)
  695. DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS)
  696. DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY)
  697. DECLARE_ASN1_FUNCTIONS(X509_NAME)
  698. int X509_NAME_set(X509_NAME **xn, X509_NAME *name);
  699. DECLARE_ASN1_FUNCTIONS(X509_CINF)
  700. DECLARE_ASN1_FUNCTIONS(X509)
  701. DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX)
  702. DECLARE_ASN1_FUNCTIONS(X509_CERT_PAIR)
  703. int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
  704. CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
  705. int X509_set_ex_data(X509 *r, int idx, void *arg);
  706. void *X509_get_ex_data(X509 *r, int idx);
  707. int i2d_X509_AUX(X509 *a, unsigned char **pp);
  708. X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length);
  709. int X509_alias_set1(X509 *x, unsigned char *name, int len);
  710. int X509_keyid_set1(X509 *x, unsigned char *id, int len);
  711. unsigned char *X509_alias_get0(X509 *x, int *len);
  712. unsigned char *X509_keyid_get0(X509 *x, int *len);
  713. int (*X509_TRUST_set_default(int (*trust) (int, X509 *, int))) (int, X509 *,
  714. int);
  715. int X509_TRUST_set(int *t, int trust);
  716. int X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj);
  717. int X509_add1_reject_object(X509 *x, ASN1_OBJECT *obj);
  718. void X509_trust_clear(X509 *x);
  719. void X509_reject_clear(X509 *x);
  720. DECLARE_ASN1_FUNCTIONS(X509_REVOKED)
  721. DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO)
  722. DECLARE_ASN1_FUNCTIONS(X509_CRL)
  723. int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);
  724. int X509_CRL_get0_by_serial(X509_CRL *crl,
  725. X509_REVOKED **ret, ASN1_INTEGER *serial);
  726. int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x);
  727. X509_PKEY *X509_PKEY_new(void);
  728. void X509_PKEY_free(X509_PKEY *a);
  729. int i2d_X509_PKEY(X509_PKEY *a, unsigned char **pp);
  730. X509_PKEY *d2i_X509_PKEY(X509_PKEY **a, const unsigned char **pp,
  731. long length);
  732. DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI)
  733. DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC)
  734. DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE)
  735. # ifndef OPENSSL_NO_EVP
  736. X509_INFO *X509_INFO_new(void);
  737. void X509_INFO_free(X509_INFO *a);
  738. char *X509_NAME_oneline(X509_NAME *a, char *buf, int size);
  739. int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1,
  740. ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey);
  741. int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,
  742. unsigned char *md, unsigned int *len);
  743. int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1,
  744. X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
  745. char *data, EVP_PKEY *pkey, const EVP_MD *type);
  746. int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *data,
  747. unsigned char *md, unsigned int *len);
  748. int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1,
  749. ASN1_BIT_STRING *signature, void *data, EVP_PKEY *pkey);
  750. int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1,
  751. X509_ALGOR *algor2, ASN1_BIT_STRING *signature, void *data,
  752. EVP_PKEY *pkey, const EVP_MD *type);
  753. int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1,
  754. X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
  755. void *asn, EVP_MD_CTX *ctx);
  756. # endif
  757. int X509_set_version(X509 *x, long version);
  758. int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial);
  759. ASN1_INTEGER *X509_get_serialNumber(X509 *x);
  760. int X509_set_issuer_name(X509 *x, X509_NAME *name);
  761. X509_NAME *X509_get_issuer_name(X509 *a);
  762. int X509_set_subject_name(X509 *x, X509_NAME *name);
  763. X509_NAME *X509_get_subject_name(X509 *a);
  764. int X509_set_notBefore(X509 *x, const ASN1_TIME *tm);
  765. int X509_set_notAfter(X509 *x, const ASN1_TIME *tm);
  766. int X509_set_pubkey(X509 *x, EVP_PKEY *pkey);
  767. EVP_PKEY *X509_get_pubkey(X509 *x);
  768. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x);
  769. int X509_certificate_type(X509 *x, EVP_PKEY *pubkey /* optional */ );
  770. int X509_REQ_set_version(X509_REQ *x, long version);
  771. int X509_REQ_set_subject_name(X509_REQ *req, X509_NAME *name);
  772. int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);
  773. EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req);
  774. int X509_REQ_extension_nid(int nid);
  775. int *X509_REQ_get_extension_nids(void);
  776. void X509_REQ_set_extension_nids(int *nids);
  777. STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req);
  778. int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts,
  779. int nid);
  780. int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts);
  781. int X509_REQ_get_attr_count(const X509_REQ *req);
  782. int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos);
  783. int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, ASN1_OBJECT *obj,
  784. int lastpos);
  785. X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc);
  786. X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc);
  787. int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr);
  788. int X509_REQ_add1_attr_by_OBJ(X509_REQ *req,
  789. const ASN1_OBJECT *obj, int type,
  790. const unsigned char *bytes, int len);
  791. int X509_REQ_add1_attr_by_NID(X509_REQ *req,
  792. int nid, int type,
  793. const unsigned char *bytes, int len);
  794. int X509_REQ_add1_attr_by_txt(X509_REQ *req,
  795. const char *attrname, int type,
  796. const unsigned char *bytes, int len);
  797. int X509_CRL_set_version(X509_CRL *x, long version);
  798. int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);
  799. int X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm);
  800. int X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm);
  801. int X509_CRL_sort(X509_CRL *crl);
  802. int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial);
  803. int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm);
  804. int X509_REQ_check_private_key(X509_REQ *x509, EVP_PKEY *pkey);
  805. int X509_check_private_key(X509 *x509, EVP_PKEY *pkey);
  806. int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b);
  807. unsigned long X509_issuer_and_serial_hash(X509 *a);
  808. int X509_issuer_name_cmp(const X509 *a, const X509 *b);
  809. unsigned long X509_issuer_name_hash(X509 *a);
  810. int X509_subject_name_cmp(const X509 *a, const X509 *b);
  811. unsigned long X509_subject_name_hash(X509 *x);
  812. # ifndef OPENSSL_NO_MD5
  813. unsigned long X509_issuer_name_hash_old(X509 *a);
  814. unsigned long X509_subject_name_hash_old(X509 *x);
  815. # endif
  816. int X509_cmp(const X509 *a, const X509 *b);
  817. int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b);
  818. unsigned long X509_NAME_hash(X509_NAME *x);
  819. unsigned long X509_NAME_hash_old(X509_NAME *x);
  820. int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);
  821. int X509_CRL_match(const X509_CRL *a, const X509_CRL *b);
  822. # ifndef OPENSSL_NO_FP_API
  823. int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag,
  824. unsigned long cflag);
  825. int X509_print_fp(FILE *bp, X509 *x);
  826. int X509_CRL_print_fp(FILE *bp, X509_CRL *x);
  827. int X509_REQ_print_fp(FILE *bp, X509_REQ *req);
  828. int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent,
  829. unsigned long flags);
  830. # endif
  831. # ifndef OPENSSL_NO_BIO
  832. int X509_NAME_print(BIO *bp, X509_NAME *name, int obase);
  833. int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent,
  834. unsigned long flags);
  835. int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflag,
  836. unsigned long cflag);
  837. int X509_print(BIO *bp, X509 *x);
  838. int X509_ocspid_print(BIO *bp, X509 *x);
  839. int X509_CERT_AUX_print(BIO *bp, X509_CERT_AUX *x, int indent);
  840. int X509_CRL_print(BIO *bp, X509_CRL *x);
  841. int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag,
  842. unsigned long cflag);
  843. int X509_REQ_print(BIO *bp, X509_REQ *req);
  844. # endif
  845. int X509_NAME_entry_count(X509_NAME *name);
  846. int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len);
  847. int X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj,
  848. char *buf, int len);
  849. /*
  850. * NOTE: you should be passsing -1, not 0 as lastpos. The functions that use
  851. * lastpos, search after that position on.
  852. */
  853. int X509_NAME_get_index_by_NID(X509_NAME *name, int nid, int lastpos);
  854. int X509_NAME_get_index_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj,
  855. int lastpos);
  856. X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc);
  857. X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc);
  858. int X509_NAME_add_entry(X509_NAME *name, X509_NAME_ENTRY *ne,
  859. int loc, int set);
  860. int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type,
  861. unsigned char *bytes, int len, int loc,
  862. int set);
  863. int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,
  864. unsigned char *bytes, int len, int loc,
  865. int set);
  866. X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,
  867. const char *field, int type,
  868. const unsigned char *bytes,
  869. int len);
  870. X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,
  871. int type, unsigned char *bytes,
  872. int len);
  873. int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type,
  874. const unsigned char *bytes, int len, int loc,
  875. int set);
  876. X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne,
  877. ASN1_OBJECT *obj, int type,
  878. const unsigned char *bytes,
  879. int len);
  880. int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, ASN1_OBJECT *obj);
  881. int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type,
  882. const unsigned char *bytes, int len);
  883. ASN1_OBJECT *X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne);
  884. ASN1_STRING *X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne);
  885. int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x);
  886. int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x,
  887. int nid, int lastpos);
  888. int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x,
  889. ASN1_OBJECT *obj, int lastpos);
  890. int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x,
  891. int crit, int lastpos);
  892. X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc);
  893. X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc);
  894. STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x,
  895. X509_EXTENSION *ex, int loc);
  896. int X509_get_ext_count(X509 *x);
  897. int X509_get_ext_by_NID(X509 *x, int nid, int lastpos);
  898. int X509_get_ext_by_OBJ(X509 *x, ASN1_OBJECT *obj, int lastpos);
  899. int X509_get_ext_by_critical(X509 *x, int crit, int lastpos);
  900. X509_EXTENSION *X509_get_ext(X509 *x, int loc);
  901. X509_EXTENSION *X509_delete_ext(X509 *x, int loc);
  902. int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);
  903. void *X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx);
  904. int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
  905. unsigned long flags);
  906. int X509_CRL_get_ext_count(X509_CRL *x);
  907. int X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos);
  908. int X509_CRL_get_ext_by_OBJ(X509_CRL *x, ASN1_OBJECT *obj, int lastpos);
  909. int X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos);
  910. X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc);
  911. X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc);
  912. int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);
  913. void *X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx);
  914. int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit,
  915. unsigned long flags);
  916. int X509_REVOKED_get_ext_count(X509_REVOKED *x);
  917. int X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos);
  918. int X509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x, ASN1_OBJECT *obj,
  919. int lastpos);
  920. int X509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int lastpos);
  921. X509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc);
  922. X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc);
  923. int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc);
  924. void *X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx);
  925. int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit,
  926. unsigned long flags);
  927. X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex,
  928. int nid, int crit,
  929. ASN1_OCTET_STRING *data);
  930. X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex,
  931. ASN1_OBJECT *obj, int crit,
  932. ASN1_OCTET_STRING *data);
  933. int X509_EXTENSION_set_object(X509_EXTENSION *ex, ASN1_OBJECT *obj);
  934. int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit);
  935. int X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data);
  936. ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex);
  937. ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne);
  938. int X509_EXTENSION_get_critical(X509_EXTENSION *ex);
  939. int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x);
  940. int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid,
  941. int lastpos);
  942. int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk,
  943. ASN1_OBJECT *obj, int lastpos);
  944. X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc);
  945. X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc);
  946. STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x,
  947. X509_ATTRIBUTE *attr);
  948. STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE)
  949. **x, const ASN1_OBJECT *obj,
  950. int type,
  951. const unsigned char *bytes,
  952. int len);
  953. STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE)
  954. **x, int nid, int type,
  955. const unsigned char *bytes,
  956. int len);
  957. STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE)
  958. **x, const char *attrname,
  959. int type,
  960. const unsigned char *bytes,
  961. int len);
  962. void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x, ASN1_OBJECT *obj,
  963. int lastpos, int type);
  964. X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid,
  965. int atrtype, const void *data,
  966. int len);
  967. X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr,
  968. const ASN1_OBJECT *obj,
  969. int atrtype, const void *data,
  970. int len);
  971. X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr,
  972. const char *atrname, int type,
  973. const unsigned char *bytes,
  974. int len);
  975. int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj);
  976. int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype,
  977. const void *data, int len);
  978. void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, int atrtype,
  979. void *data);
  980. int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr);
  981. ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr);
  982. ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx);
  983. int EVP_PKEY_get_attr_count(const EVP_PKEY *key);
  984. int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos);
  985. int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, ASN1_OBJECT *obj,
  986. int lastpos);
  987. X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc);
  988. X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc);
  989. int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr);
  990. int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key,
  991. const ASN1_OBJECT *obj, int type,
  992. const unsigned char *bytes, int len);
  993. int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key,
  994. int nid, int type,
  995. const unsigned char *bytes, int len);
  996. int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key,
  997. const char *attrname, int type,
  998. const unsigned char *bytes, int len);
  999. int X509_verify_cert(X509_STORE_CTX *ctx);
  1000. /* lookup a cert from a X509 STACK */
  1001. X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, X509_NAME *name,
  1002. ASN1_INTEGER *serial);
  1003. X509 *X509_find_by_subject(STACK_OF(X509) *sk, X509_NAME *name);
  1004. DECLARE_ASN1_FUNCTIONS(PBEPARAM)
  1005. DECLARE_ASN1_FUNCTIONS(PBE2PARAM)
  1006. DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM)
  1007. int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
  1008. const unsigned char *salt, int saltlen);
  1009. X509_ALGOR *PKCS5_pbe_set(int alg, int iter,
  1010. const unsigned char *salt, int saltlen);
  1011. X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
  1012. unsigned char *salt, int saltlen);
  1013. X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
  1014. unsigned char *salt, int saltlen,
  1015. unsigned char *aiv, int prf_nid);
  1016. X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen,
  1017. int prf_nid, int keylen);
  1018. /* PKCS#8 utilities */
  1019. DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)
  1020. EVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8);
  1021. PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey);
  1022. PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken);
  1023. PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken);
  1024. int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj,
  1025. int version, int ptype, void *pval,
  1026. unsigned char *penc, int penclen);
  1027. int PKCS8_pkey_get0(ASN1_OBJECT **ppkalg,
  1028. const unsigned char **pk, int *ppklen,
  1029. X509_ALGOR **pa, PKCS8_PRIV_KEY_INFO *p8);
  1030. int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj,
  1031. int ptype, void *pval,
  1032. unsigned char *penc, int penclen);
  1033. int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg,
  1034. const unsigned char **pk, int *ppklen,
  1035. X509_ALGOR **pa, X509_PUBKEY *pub);
  1036. int X509_check_trust(X509 *x, int id, int flags);
  1037. int X509_TRUST_get_count(void);
  1038. X509_TRUST *X509_TRUST_get0(int idx);
  1039. int X509_TRUST_get_by_id(int id);
  1040. int X509_TRUST_add(int id, int flags, int (*ck) (X509_TRUST *, X509 *, int),
  1041. char *name, int arg1, void *arg2);
  1042. void X509_TRUST_cleanup(void);
  1043. int X509_TRUST_get_flags(X509_TRUST *xp);
  1044. char *X509_TRUST_get0_name(X509_TRUST *xp);
  1045. int X509_TRUST_get_trust(X509_TRUST *xp);
  1046. /* BEGIN ERROR CODES */
  1047. /*
  1048. * The following lines are auto generated by the script mkerr.pl. Any changes
  1049. * made after this point may be overwritten when the script is next run.
  1050. */
  1051. void ERR_load_X509_strings(void);
  1052. /* Error codes for the X509 functions. */
  1053. /* Function codes. */
  1054. # define X509_F_ADD_CERT_DIR 100
  1055. # define X509_F_BY_FILE_CTRL 101
  1056. # define X509_F_CHECK_NAME_CONSTRAINTS 106
  1057. # define X509_F_CHECK_POLICY 145
  1058. # define X509_F_DIR_CTRL 102
  1059. # define X509_F_GET_CERT_BY_SUBJECT 103
  1060. # define X509_F_NETSCAPE_SPKI_B64_DECODE 129
  1061. # define X509_F_NETSCAPE_SPKI_B64_ENCODE 130
  1062. # define X509_F_X509AT_ADD1_ATTR 135
  1063. # define X509_F_X509V3_ADD_EXT 104
  1064. # define X509_F_X509_ATTRIBUTE_CREATE_BY_NID 136
  1065. # define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 137
  1066. # define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 140
  1067. # define X509_F_X509_ATTRIBUTE_GET0_DATA 139
  1068. # define X509_F_X509_ATTRIBUTE_SET1_DATA 138
  1069. # define X509_F_X509_CHECK_PRIVATE_KEY 128
  1070. # define X509_F_X509_CRL_PRINT_FP 147
  1071. # define X509_F_X509_EXTENSION_CREATE_BY_NID 108
  1072. # define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109
  1073. # define X509_F_X509_GET_PUBKEY_PARAMETERS 110
  1074. # define X509_F_X509_LOAD_CERT_CRL_FILE 132
  1075. # define X509_F_X509_LOAD_CERT_FILE 111
  1076. # define X509_F_X509_LOAD_CRL_FILE 112
  1077. # define X509_F_X509_NAME_ADD_ENTRY 113
  1078. # define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114
  1079. # define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT 131
  1080. # define X509_F_X509_NAME_ENTRY_SET_OBJECT 115
  1081. # define X509_F_X509_NAME_ONELINE 116
  1082. # define X509_F_X509_NAME_PRINT 117
  1083. # define X509_F_X509_PRINT_EX_FP 118
  1084. # define X509_F_X509_PUBKEY_GET 119
  1085. # define X509_F_X509_PUBKEY_SET 120
  1086. # define X509_F_X509_REQ_CHECK_PRIVATE_KEY 144
  1087. # define X509_F_X509_REQ_PRINT_EX 121
  1088. # define X509_F_X509_REQ_PRINT_FP 122
  1089. # define X509_F_X509_REQ_TO_X509 123
  1090. # define X509_F_X509_STORE_ADD_CERT 124
  1091. # define X509_F_X509_STORE_ADD_CRL 125
  1092. # define X509_F_X509_STORE_CTX_GET1_ISSUER 146
  1093. # define X509_F_X509_STORE_CTX_INIT 143
  1094. # define X509_F_X509_STORE_CTX_NEW 142
  1095. # define X509_F_X509_STORE_CTX_PURPOSE_INHERIT 134
  1096. # define X509_F_X509_TO_X509_REQ 126
  1097. # define X509_F_X509_TRUST_ADD 133
  1098. # define X509_F_X509_TRUST_SET 141
  1099. # define X509_F_X509_VERIFY_CERT 127
  1100. /* Reason codes. */
  1101. # define X509_R_BAD_X509_FILETYPE 100
  1102. # define X509_R_BASE64_DECODE_ERROR 118
  1103. # define X509_R_CANT_CHECK_DH_KEY 114
  1104. # define X509_R_CERT_ALREADY_IN_HASH_TABLE 101
  1105. # define X509_R_ERR_ASN1_LIB 102
  1106. # define X509_R_INVALID_DIRECTORY 113
  1107. # define X509_R_INVALID_FIELD_NAME 119
  1108. # define X509_R_INVALID_TRUST 123
  1109. # define X509_R_KEY_TYPE_MISMATCH 115
  1110. # define X509_R_KEY_VALUES_MISMATCH 116
  1111. # define X509_R_LOADING_CERT_DIR 103
  1112. # define X509_R_LOADING_DEFAULTS 104
  1113. # define X509_R_METHOD_NOT_SUPPORTED 124
  1114. # define X509_R_NAME_TOO_LONG 134
  1115. # define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105
  1116. # define X509_R_PUBLIC_KEY_DECODE_ERROR 125
  1117. # define X509_R_PUBLIC_KEY_ENCODE_ERROR 126
  1118. # define X509_R_SHOULD_RETRY 106
  1119. # define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107
  1120. # define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108
  1121. # define X509_R_UNKNOWN_KEY_TYPE 117
  1122. # define X509_R_UNKNOWN_NID 109
  1123. # define X509_R_UNKNOWN_PURPOSE_ID 121
  1124. # define X509_R_UNKNOWN_TRUST_ID 120
  1125. # define X509_R_UNSUPPORTED_ALGORITHM 111
  1126. # define X509_R_WRONG_LOOKUP_TYPE 112
  1127. # define X509_R_WRONG_TYPE 122
  1128. # ifdef __cplusplus
  1129. }
  1130. # endif
  1131. #endif