]>
Commit | Line | Data |
---|---|---|
b1ab9ed8 | 1 | /* |
d8f41ccd | 2 | * Copyright (c) 2000-2001,2011,2014 Apple Inc. All Rights Reserved. |
b1ab9ed8 A |
3 | * |
4 | * The contents of this file constitute Original Code as defined in and are | |
5 | * subject to the Apple Public Source License Version 1.2 (the 'License'). | |
6 | * You may not use this file except in compliance with the License. Please obtain | |
7 | * a copy of the License at http://www.apple.com/publicsource and read it before | |
8 | * using this file. | |
9 | * | |
10 | * This Original Code and all software distributed under the License are | |
11 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS | |
12 | * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT | |
13 | * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | |
14 | * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the | |
15 | * specific language governing rights and limitations under the License. | |
16 | */ | |
17 | ||
18 | ||
19 | /* crypto/x509/x509.h */ | |
20 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | |
21 | * All rights reserved. | |
22 | * | |
23 | * This package is an SSL implementation written | |
24 | * by Eric Young (eay@cryptsoft.com). | |
25 | * The implementation was written so as to conform with Netscapes SSL. | |
26 | * | |
27 | * This library is free for commercial and non-commercial use as long as | |
28 | * the following conditions are aheared to. The following conditions | |
29 | * apply to all code found in this distribution, be it the RC4, RSA, | |
30 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | |
31 | * included with this distribution is covered by the same copyright terms | |
32 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | |
33 | * | |
34 | * Copyright remains Eric Young's, and as such any Copyright notices in | |
35 | * the code are not to be removed. | |
36 | * If this package is used in a product, Eric Young should be given attribution | |
37 | * as the author of the parts of the library used. | |
38 | * This can be in the form of a textual message at program startup or | |
39 | * in documentation (online or textual) provided with the package. | |
40 | * | |
41 | * Redistribution and use in source and binary forms, with or without | |
42 | * modification, are permitted provided that the following conditions | |
43 | * are met: | |
44 | * 1. Redistributions of source code must retain the copyright | |
45 | * notice, this list of conditions and the following disclaimer. | |
46 | * 2. Redistributions in binary form must reproduce the above copyright | |
47 | * notice, this list of conditions and the following disclaimer in the | |
48 | * documentation and/or other materials provided with the distribution. | |
49 | * 3. All advertising materials mentioning features or use of this software | |
50 | * must display the following acknowledgement: | |
51 | * "This product includes cryptographic software written by | |
52 | * Eric Young (eay@cryptsoft.com)" | |
53 | * The word 'cryptographic' can be left out if the rouines from the library | |
54 | * being used are not cryptographic related :-). | |
55 | * 4. If you include any Windows specific code (or a derivative thereof) from | |
56 | * the apps directory (application code) you must include an acknowledgement: | |
57 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | |
58 | * | |
59 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | |
60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
69 | * SUCH DAMAGE. | |
70 | * | |
71 | * The licence and distribution terms for any publically available version or | |
72 | * derivative of this code cannot be changed. i.e. this code cannot simply be | |
73 | * copied and put under another distribution licence | |
74 | * [including the GNU Public Licence.] | |
75 | */ | |
76 | ||
77 | #ifndef HEADER_X509_H | |
78 | #define HEADER_X509_H | |
79 | ||
80 | #ifdef __cplusplus | |
81 | extern "C" { | |
82 | #endif | |
83 | ||
84 | #ifdef VMS | |
85 | #undef X509_REVOKED_get_ext_by_critical | |
86 | #define X509_REVOKED_get_ext_by_critical X509_REVOKED_get_ext_by_critic | |
87 | #endif | |
88 | ||
89 | #include <openssl/stack.h> | |
90 | #include <openssl/asn1.h> | |
91 | #include <openssl/safestack.h> | |
92 | ||
93 | #ifndef NO_RSA | |
94 | #include <openssl/rsa.h> | |
95 | #endif | |
96 | ||
97 | #ifndef NO_DSA | |
98 | #include <openssl/dsa.h> | |
99 | #endif | |
100 | ||
101 | #ifndef NO_DH | |
102 | #include <openssl/dh.h> | |
103 | #endif | |
104 | ||
105 | #include <openssl/evp.h> | |
106 | ||
107 | ||
108 | #ifdef WIN32 | |
109 | /* Under Win32 this is defined in wincrypt.h */ | |
110 | #undef X509_NAME | |
111 | #endif | |
112 | ||
113 | #define X509_FILETYPE_PEM 1 | |
114 | #define X509_FILETYPE_ASN1 2 | |
115 | #define X509_FILETYPE_DEFAULT 3 | |
116 | ||
117 | #define X509v3_KU_DIGITAL_SIGNATURE 0x0080 | |
118 | #define X509v3_KU_NON_REPUDIATION 0x0040 | |
119 | #define X509v3_KU_KEY_ENCIPHERMENT 0x0020 | |
120 | #define X509v3_KU_DATA_ENCIPHERMENT 0x0010 | |
121 | #define X509v3_KU_KEY_AGREEMENT 0x0008 | |
122 | #define X509v3_KU_KEY_CERT_SIGN 0x0004 | |
123 | #define X509v3_KU_CRL_SIGN 0x0002 | |
124 | #define X509v3_KU_ENCIPHER_ONLY 0x0001 | |
125 | #define X509v3_KU_DECIPHER_ONLY 0x8000 | |
126 | #define X509v3_KU_UNDEF 0xffff | |
127 | ||
128 | typedef struct X509_objects_st | |
129 | { | |
130 | int nid; | |
131 | int (*a2i)(); | |
132 | int (*i2a)(); | |
133 | } X509_OBJECTS; | |
134 | ||
135 | typedef struct X509_algor_st | |
136 | { | |
137 | ASN1_OBJECT *algorithm; | |
138 | ASN1_TYPE *parameter; | |
139 | } X509_ALGOR; | |
140 | ||
141 | DECLARE_STACK_OF(X509_ALGOR) | |
142 | DECLARE_ASN1_SET_OF(X509_ALGOR) | |
143 | ||
144 | typedef struct X509_val_st | |
145 | { | |
146 | ASN1_UTCTIME *notBefore; | |
147 | ASN1_UTCTIME *notAfter; | |
148 | } X509_VAL; | |
149 | ||
150 | typedef struct X509_pubkey_st | |
151 | { | |
152 | X509_ALGOR *algor; | |
153 | ASN1_BIT_STRING *public_key; | |
154 | EVP_PKEY *pkey; | |
155 | } X509_PUBKEY; | |
156 | ||
157 | typedef struct X509_sig_st | |
158 | { | |
159 | X509_ALGOR *algor; | |
160 | ASN1_OCTET_STRING *digest; | |
161 | } X509_SIG; | |
162 | ||
163 | typedef struct X509_name_entry_st | |
164 | { | |
165 | ASN1_OBJECT *object; | |
166 | ASN1_STRING *value; | |
167 | int set; | |
168 | int size; /* temp variable */ | |
169 | } X509_NAME_ENTRY; | |
170 | ||
171 | DECLARE_STACK_OF(X509_NAME_ENTRY) | |
172 | DECLARE_ASN1_SET_OF(X509_NAME_ENTRY) | |
173 | ||
174 | /* we always keep X509_NAMEs in 2 forms. */ | |
175 | typedef struct X509_name_st | |
176 | { | |
177 | STACK_OF(X509_NAME_ENTRY) *entries; | |
178 | int modified; /* true if 'bytes' needs to be built */ | |
179 | #ifdef HEADER_BUFFER_H | |
180 | BUF_MEM *bytes; | |
181 | #else | |
182 | char *bytes; | |
183 | #endif | |
184 | unsigned long hash; /* Keep the hash around for lookups */ | |
185 | } X509_NAME; | |
186 | ||
187 | DECLARE_STACK_OF(X509_NAME) | |
188 | ||
189 | #define X509_EX_V_NETSCAPE_HACK 0x8000 | |
190 | #define X509_EX_V_INIT 0x0001 | |
191 | typedef struct X509_extension_st | |
192 | { | |
193 | ASN1_OBJECT *object; | |
194 | short critical; | |
195 | short netscape_hack; | |
196 | ASN1_OCTET_STRING *value; | |
197 | struct v3_ext_method *method; /* V3 method to use */ | |
198 | void *ext_val; /* extension value */ | |
199 | } X509_EXTENSION; | |
200 | ||
201 | DECLARE_STACK_OF(X509_EXTENSION) | |
202 | DECLARE_ASN1_SET_OF(X509_EXTENSION) | |
203 | ||
204 | /* a sequence of these are used */ | |
205 | typedef struct x509_attributes_st | |
206 | { | |
207 | ASN1_OBJECT *object; | |
208 | int set; /* 1 for a set, 0 for a single item (which is wrong) */ | |
209 | union { | |
210 | char *ptr; | |
211 | /* 1 */ STACK_OF(ASN1_TYPE) *set; | |
212 | /* 0 */ ASN1_TYPE *single; | |
213 | } value; | |
214 | } X509_ATTRIBUTE; | |
215 | ||
216 | DECLARE_STACK_OF(X509_ATTRIBUTE) | |
217 | DECLARE_ASN1_SET_OF(X509_ATTRIBUTE) | |
218 | ||
219 | typedef struct X509_req_info_st | |
220 | { | |
221 | ASN1_INTEGER *version; | |
222 | X509_NAME *subject; | |
223 | X509_PUBKEY *pubkey; | |
224 | /* d=2 hl=2 l= 0 cons: cont: 00 */ | |
225 | STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */ | |
226 | int req_kludge; | |
227 | } X509_REQ_INFO; | |
228 | ||
229 | typedef struct X509_req_st | |
230 | { | |
231 | X509_REQ_INFO *req_info; | |
232 | X509_ALGOR *sig_alg; | |
233 | ASN1_BIT_STRING *signature; | |
234 | int references; | |
235 | } X509_REQ; | |
236 | ||
237 | typedef struct x509_cinf_st | |
238 | { | |
239 | ASN1_INTEGER *version; /* [ 0 ] default of v1 */ | |
240 | ASN1_INTEGER *serialNumber; | |
241 | X509_ALGOR *signature; | |
242 | X509_NAME *issuer; | |
243 | X509_VAL *validity; | |
244 | X509_NAME *subject; | |
245 | X509_PUBKEY *key; | |
246 | ASN1_BIT_STRING *issuerUID; /* [ 1 ] optional in v2 */ | |
247 | ASN1_BIT_STRING *subjectUID; /* [ 2 ] optional in v2 */ | |
248 | STACK_OF(X509_EXTENSION) *extensions; /* [ 3 ] optional in v3 */ | |
249 | } X509_CINF; | |
250 | ||
251 | /* This stuff is certificate "auxiliary info" | |
252 | * it contains details which are useful in certificate | |
253 | * stores and databases. When used this is tagged onto | |
254 | * the end of the certificate itself | |
255 | */ | |
256 | ||
257 | typedef struct x509_cert_aux_st | |
258 | { | |
259 | STACK_OF(ASN1_OBJECT) *trust; /* trusted uses */ | |
260 | STACK_OF(ASN1_OBJECT) *reject; /* rejected uses */ | |
261 | ASN1_UTF8STRING *alias; /* "friendly name" */ | |
262 | ASN1_OCTET_STRING *keyid; /* key id of private key */ | |
263 | STACK_OF(X509_ALGOR) *other; /* other unspecified info */ | |
264 | } X509_CERT_AUX; | |
265 | ||
266 | typedef struct x509_st | |
267 | { | |
268 | X509_CINF *cert_info; | |
269 | X509_ALGOR *sig_alg; | |
270 | ASN1_BIT_STRING *signature; | |
271 | int valid; | |
272 | int references; | |
273 | char *name; | |
274 | CRYPTO_EX_DATA ex_data; | |
275 | /* These contain copies of various extension values */ | |
276 | long ex_pathlen; | |
277 | unsigned long ex_flags; | |
278 | unsigned long ex_kusage; | |
279 | unsigned long ex_xkusage; | |
280 | unsigned long ex_nscert; | |
281 | #ifndef NO_SHA | |
282 | unsigned char sha1_hash[SHA_DIGEST_LENGTH]; | |
283 | #endif | |
284 | X509_CERT_AUX *aux; | |
285 | } X509; | |
286 | ||
287 | DECLARE_STACK_OF(X509) | |
288 | DECLARE_ASN1_SET_OF(X509) | |
289 | ||
290 | /* This is used for a table of trust checking functions */ | |
291 | ||
292 | typedef struct x509_trust_st { | |
293 | int trust; | |
294 | int flags; | |
295 | int (*check_trust)(struct x509_trust_st *, X509 *, int); | |
296 | char *name; | |
297 | int arg1; | |
298 | void *arg2; | |
299 | } X509_TRUST; | |
300 | ||
301 | DECLARE_STACK_OF(X509_TRUST) | |
302 | ||
303 | /* standard trust ids */ | |
304 | ||
305 | #define X509_TRUST_DEFAULT -1 /* Only valid in purpose settings */ | |
306 | ||
307 | #define X509_TRUST_COMPAT 1 | |
308 | #define X509_TRUST_SSL_CLIENT 2 | |
309 | #define X509_TRUST_SSL_SERVER 3 | |
310 | #define X509_TRUST_EMAIL 4 | |
311 | #define X509_TRUST_OBJECT_SIGN 5 | |
312 | ||
313 | /* Keep these up to date! */ | |
314 | #define X509_TRUST_MIN 1 | |
315 | #define X509_TRUST_MAX 5 | |
316 | ||
317 | ||
318 | /* trust_flags values */ | |
319 | #define X509_TRUST_DYNAMIC 1 | |
320 | #define X509_TRUST_DYNAMIC_NAME 2 | |
321 | ||
322 | /* check_trust return codes */ | |
323 | ||
324 | #define X509_TRUST_TRUSTED 1 | |
325 | #define X509_TRUST_REJECTED 2 | |
326 | #define X509_TRUST_UNTRUSTED 3 | |
327 | ||
328 | typedef struct X509_revoked_st | |
329 | { | |
330 | ASN1_INTEGER *serialNumber; | |
331 | ASN1_UTCTIME *revocationDate; | |
332 | STACK_OF(X509_EXTENSION) /* optional */ *extensions; | |
333 | int sequence; /* load sequence */ | |
334 | } X509_REVOKED; | |
335 | ||
336 | DECLARE_STACK_OF(X509_REVOKED) | |
337 | DECLARE_ASN1_SET_OF(X509_REVOKED) | |
338 | ||
339 | typedef struct X509_crl_info_st | |
340 | { | |
341 | ASN1_INTEGER *version; | |
342 | X509_ALGOR *sig_alg; | |
343 | X509_NAME *issuer; | |
344 | ASN1_UTCTIME *lastUpdate; | |
345 | ASN1_UTCTIME *nextUpdate; | |
346 | STACK_OF(X509_REVOKED) *revoked; | |
347 | STACK_OF(X509_EXTENSION) /* [0] */ *extensions; | |
348 | } X509_CRL_INFO; | |
349 | ||
350 | typedef struct X509_crl_st | |
351 | { | |
352 | /* actual signature */ | |
353 | X509_CRL_INFO *crl; | |
354 | X509_ALGOR *sig_alg; | |
355 | ASN1_BIT_STRING *signature; | |
356 | int references; | |
357 | } X509_CRL; | |
358 | ||
359 | DECLARE_STACK_OF(X509_CRL) | |
360 | DECLARE_ASN1_SET_OF(X509_CRL) | |
361 | ||
362 | typedef struct private_key_st | |
363 | { | |
364 | int version; | |
365 | /* The PKCS#8 data types */ | |
366 | X509_ALGOR *enc_algor; | |
367 | ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ | |
368 | ||
369 | /* When decrypted, the following will not be NULL */ | |
370 | EVP_PKEY *dec_pkey; | |
371 | ||
372 | /* used to encrypt and decrypt */ | |
373 | int key_length; | |
374 | char *key_data; | |
375 | int key_free; /* true if we should auto free key_data */ | |
376 | ||
377 | /* expanded version of 'enc_algor' */ | |
378 | EVP_CIPHER_INFO cipher; | |
379 | ||
380 | int references; | |
381 | } X509_PKEY; | |
382 | ||
383 | #ifdef HEADER_ENVELOPE_H | |
384 | typedef struct X509_info_st | |
385 | { | |
386 | X509 *x509; | |
387 | X509_CRL *crl; | |
388 | X509_PKEY *x_pkey; | |
389 | ||
390 | EVP_CIPHER_INFO enc_cipher; | |
391 | int enc_len; | |
392 | char *enc_data; | |
393 | ||
394 | int references; | |
395 | } X509_INFO; | |
396 | ||
397 | DECLARE_STACK_OF(X509_INFO) | |
398 | #endif | |
399 | ||
400 | /* The next 2 structures and their 8 routines were sent to me by | |
401 | * Pat Richard <patr@x509.com> and are used to manipulate | |
402 | * Netscapes spki structures - useful if you are writing a CA web page | |
403 | */ | |
404 | typedef struct Netscape_spkac_st | |
405 | { | |
406 | X509_PUBKEY *pubkey; | |
407 | ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */ | |
408 | } NETSCAPE_SPKAC; | |
409 | ||
410 | typedef struct Netscape_spki_st | |
411 | { | |
412 | NETSCAPE_SPKAC *spkac; /* signed public key and challenge */ | |
413 | X509_ALGOR *sig_algor; | |
414 | ASN1_BIT_STRING *signature; | |
415 | } NETSCAPE_SPKI; | |
416 | ||
417 | /* Netscape certificate sequence structure */ | |
418 | typedef struct Netscape_certificate_sequence | |
419 | { | |
420 | ASN1_OBJECT *type; | |
421 | STACK_OF(X509) *certs; | |
422 | } NETSCAPE_CERT_SEQUENCE; | |
423 | ||
424 | typedef struct CBCParameter_st | |
425 | { | |
426 | unsigned char iv[8]; | |
427 | } CBC_PARAM; | |
428 | ||
429 | /* Password based encryption structure */ | |
430 | ||
431 | typedef struct PBEPARAM_st { | |
432 | ASN1_OCTET_STRING *salt; | |
433 | ASN1_INTEGER *iter; | |
434 | } PBEPARAM; | |
435 | ||
436 | /* Password based encryption V2 structures */ | |
437 | ||
438 | typedef struct PBE2PARAM_st { | |
439 | X509_ALGOR *keyfunc; | |
440 | X509_ALGOR *encryption; | |
441 | } PBE2PARAM; | |
442 | ||
443 | typedef struct PBKDF2PARAM_st { | |
444 | ASN1_TYPE *salt; /* Usually OCTET STRING but could be anything */ | |
445 | ASN1_INTEGER *iter; | |
446 | ASN1_INTEGER *keylength; | |
447 | X509_ALGOR *prf; | |
448 | } PBKDF2PARAM; | |
449 | ||
450 | ||
451 | /* PKCS#8 private key info structure */ | |
452 | ||
453 | typedef struct pkcs8_priv_key_info_st | |
454 | { | |
455 | int broken; /* Flag for various broken formats */ | |
456 | #define PKCS8_OK 0 | |
457 | #define PKCS8_NO_OCTET 1 | |
458 | #define PKCS8_EMBEDDED_PARAM 2 | |
459 | #define PKCS8_NS_DB 3 | |
460 | ASN1_INTEGER *version; | |
461 | X509_ALGOR *pkeyalg; | |
462 | ASN1_TYPE *pkey; /* Should be OCTET STRING but some are broken */ | |
463 | STACK_OF(X509_ATTRIBUTE) *attributes; | |
464 | } PKCS8_PRIV_KEY_INFO; | |
465 | ||
466 | #include <openssl/x509_vfy.h> | |
467 | #include <openssl/openssl_pkcs7.h> | |
468 | ||
469 | #ifdef SSLEAY_MACROS | |
470 | #define X509_verify(a,r) ASN1_verify((int (*)())i2d_X509_CINF,a->sig_alg,\ | |
471 | a->signature,(char *)a->cert_info,r) | |
472 | #define X509_REQ_verify(a,r) ASN1_verify((int (*)())i2d_X509_REQ_INFO, \ | |
473 | a->sig_alg,a->signature,(char *)a->req_info,r) | |
474 | #define X509_CRL_verify(a,r) ASN1_verify((int (*)())i2d_X509_CRL_INFO, \ | |
475 | a->sig_alg, a->signature,(char *)a->crl,r) | |
476 | ||
477 | #define X509_sign(x,pkey,md) \ | |
478 | ASN1_sign((int (*)())i2d_X509_CINF, x->cert_info->signature, \ | |
479 | x->sig_alg, x->signature, (char *)x->cert_info,pkey,md) | |
480 | #define X509_REQ_sign(x,pkey,md) \ | |
481 | ASN1_sign((int (*)())i2d_X509_REQ_INFO,x->sig_alg, NULL, \ | |
482 | x->signature, (char *)x->req_info,pkey,md) | |
483 | #define X509_CRL_sign(x,pkey,md) \ | |
484 | ASN1_sign((int (*)())i2d_X509_CRL_INFO,x->crl->sig_alg,x->sig_alg, \ | |
485 | x->signature, (char *)x->crl,pkey,md) | |
486 | #define NETSCAPE_SPKI_sign(x,pkey,md) \ | |
487 | ASN1_sign((int (*)())i2d_NETSCAPE_SPKAC, x->sig_algor,NULL, \ | |
488 | x->signature, (char *)x->spkac,pkey,md) | |
489 | ||
490 | #define X509_dup(x509) (X509 *)ASN1_dup((int (*)())i2d_X509, \ | |
491 | (char *(*)())d2i_X509,(char *)x509) | |
492 | #define X509_ATTRIBUTE_dup(xa) (X509_ATTRIBUTE *)ASN1_dup(\ | |
493 | (int (*)())i2d_X509_ATTRIBUTE, \ | |
494 | (char *(*)())d2i_X509_ATTRIBUTE,(char *)xa) | |
495 | #define X509_EXTENSION_dup(ex) (X509_EXTENSION *)ASN1_dup( \ | |
496 | (int (*)())i2d_X509_EXTENSION, \ | |
497 | (char *(*)())d2i_X509_EXTENSION,(char *)ex) | |
498 | #define d2i_X509_fp(fp,x509) (X509 *)ASN1_d2i_fp((char *(*)())X509_new, \ | |
499 | (char *(*)())d2i_X509, (fp),(unsigned char **)(x509)) | |
500 | #define i2d_X509_fp(fp,x509) ASN1_i2d_fp(i2d_X509,fp,(unsigned char *)x509) | |
501 | #define d2i_X509_bio(bp,x509) (X509 *)ASN1_d2i_bio((char *(*)())X509_new, \ | |
502 | (char *(*)())d2i_X509, (bp),(unsigned char **)(x509)) | |
503 | #define i2d_X509_bio(bp,x509) ASN1_i2d_bio(i2d_X509,bp,(unsigned char *)x509) | |
504 | ||
505 | #define X509_CRL_dup(crl) (X509_CRL *)ASN1_dup((int (*)())i2d_X509_CRL, \ | |
506 | (char *(*)())d2i_X509_CRL,(char *)crl) | |
507 | #define d2i_X509_CRL_fp(fp,crl) (X509_CRL *)ASN1_d2i_fp((char *(*)()) \ | |
508 | X509_CRL_new,(char *(*)())d2i_X509_CRL, (fp),\ | |
509 | (unsigned char **)(crl)) | |
510 | #define i2d_X509_CRL_fp(fp,crl) ASN1_i2d_fp(i2d_X509_CRL,fp,\ | |
511 | (unsigned char *)crl) | |
512 | #define d2i_X509_CRL_bio(bp,crl) (X509_CRL *)ASN1_d2i_bio((char *(*)()) \ | |
513 | X509_CRL_new,(char *(*)())d2i_X509_CRL, (bp),\ | |
514 | (unsigned char **)(crl)) | |
515 | #define i2d_X509_CRL_bio(bp,crl) ASN1_i2d_bio(i2d_X509_CRL,bp,\ | |
516 | (unsigned char *)crl) | |
517 | ||
518 | #define PKCS7_dup(p7) (PKCS7 *)ASN1_dup((int (*)())i2d_PKCS7, \ | |
519 | (char *(*)())d2i_PKCS7,(char *)p7) | |
520 | #define d2i_PKCS7_fp(fp,p7) (PKCS7 *)ASN1_d2i_fp((char *(*)()) \ | |
521 | PKCS7_new,(char *(*)())d2i_PKCS7, (fp),\ | |
522 | (unsigned char **)(p7)) | |
523 | #define i2d_PKCS7_fp(fp,p7) ASN1_i2d_fp(i2d_PKCS7,fp,\ | |
524 | (unsigned char *)p7) | |
525 | #define d2i_PKCS7_bio(bp,p7) (PKCS7 *)ASN1_d2i_bio((char *(*)()) \ | |
526 | PKCS7_new,(char *(*)())d2i_PKCS7, (bp),\ | |
527 | (unsigned char **)(p7)) | |
528 | #define i2d_PKCS7_bio(bp,p7) ASN1_i2d_bio(i2d_PKCS7,bp,\ | |
529 | (unsigned char *)p7) | |
530 | ||
531 | #define X509_REQ_dup(req) (X509_REQ *)ASN1_dup((int (*)())i2d_X509_REQ, \ | |
532 | (char *(*)())d2i_X509_REQ,(char *)req) | |
533 | #define d2i_X509_REQ_fp(fp,req) (X509_REQ *)ASN1_d2i_fp((char *(*)())\ | |
534 | X509_REQ_new, (char *(*)())d2i_X509_REQ, (fp),\ | |
535 | (unsigned char **)(req)) | |
536 | #define i2d_X509_REQ_fp(fp,req) ASN1_i2d_fp(i2d_X509_REQ,fp,\ | |
537 | (unsigned char *)req) | |
538 | #define d2i_X509_REQ_bio(bp,req) (X509_REQ *)ASN1_d2i_bio((char *(*)())\ | |
539 | X509_REQ_new, (char *(*)())d2i_X509_REQ, (bp),\ | |
540 | (unsigned char **)(req)) | |
541 | #define i2d_X509_REQ_bio(bp,req) ASN1_i2d_bio(i2d_X509_REQ,bp,\ | |
542 | (unsigned char *)req) | |
543 | ||
544 | #define RSAPublicKey_dup(rsa) (RSA *)ASN1_dup((int (*)())i2d_RSAPublicKey, \ | |
545 | (char *(*)())d2i_RSAPublicKey,(char *)rsa) | |
546 | #define RSAPrivateKey_dup(rsa) (RSA *)ASN1_dup((int (*)())i2d_RSAPrivateKey, \ | |
547 | (char *(*)())d2i_RSAPrivateKey,(char *)rsa) | |
548 | ||
549 | #define d2i_RSAPrivateKey_fp(fp,rsa) (RSA *)ASN1_d2i_fp((char *(*)())\ | |
550 | RSA_new,(char *(*)())d2i_RSAPrivateKey, (fp), \ | |
551 | (unsigned char **)(rsa)) | |
552 | #define i2d_RSAPrivateKey_fp(fp,rsa) ASN1_i2d_fp(i2d_RSAPrivateKey,fp, \ | |
553 | (unsigned char *)rsa) | |
554 | #define d2i_RSAPrivateKey_bio(bp,rsa) (RSA *)ASN1_d2i_bio((char *(*)())\ | |
555 | RSA_new,(char *(*)())d2i_RSAPrivateKey, (bp), \ | |
556 | (unsigned char **)(rsa)) | |
557 | #define i2d_RSAPrivateKey_bio(bp,rsa) ASN1_i2d_bio(i2d_RSAPrivateKey,bp, \ | |
558 | (unsigned char *)rsa) | |
559 | ||
560 | #define d2i_RSAPublicKey_fp(fp,rsa) (RSA *)ASN1_d2i_fp((char *(*)())\ | |
561 | RSA_new,(char *(*)())d2i_RSAPublicKey, (fp), \ | |
562 | (unsigned char **)(rsa)) | |
563 | #define i2d_RSAPublicKey_fp(fp,rsa) ASN1_i2d_fp(i2d_RSAPublicKey,fp, \ | |
564 | (unsigned char *)rsa) | |
565 | #define d2i_RSAPublicKey_bio(bp,rsa) (RSA *)ASN1_d2i_bio((char *(*)())\ | |
566 | RSA_new,(char *(*)())d2i_RSAPublicKey, (bp), \ | |
567 | (unsigned char **)(rsa)) | |
568 | #define i2d_RSAPublicKey_bio(bp,rsa) ASN1_i2d_bio(i2d_RSAPublicKey,bp, \ | |
569 | (unsigned char *)rsa) | |
570 | ||
571 | #define d2i_DSAPrivateKey_fp(fp,dsa) (DSA *)ASN1_d2i_fp((char *(*)())\ | |
572 | DSA_new,(char *(*)())d2i_DSAPrivateKey, (fp), \ | |
573 | (unsigned char **)(dsa)) | |
574 | #define i2d_DSAPrivateKey_fp(fp,dsa) ASN1_i2d_fp(i2d_DSAPrivateKey,fp, \ | |
575 | (unsigned char *)dsa) | |
576 | #define d2i_DSAPrivateKey_bio(bp,dsa) (DSA *)ASN1_d2i_bio((char *(*)())\ | |
577 | DSA_new,(char *(*)())d2i_DSAPrivateKey, (bp), \ | |
578 | (unsigned char **)(dsa)) | |
579 | #define i2d_DSAPrivateKey_bio(bp,dsa) ASN1_i2d_bio(i2d_DSAPrivateKey,bp, \ | |
580 | (unsigned char *)dsa) | |
581 | ||
582 | #define X509_ALGOR_dup(xn) (X509_ALGOR *)ASN1_dup((int (*)())i2d_X509_ALGOR,\ | |
583 | (char *(*)())d2i_X509_ALGOR,(char *)xn) | |
584 | ||
585 | #define X509_NAME_dup(xn) (X509_NAME *)ASN1_dup((int (*)())i2d_X509_NAME, \ | |
586 | (char *(*)())d2i_X509_NAME,(char *)xn) | |
587 | #define X509_NAME_ENTRY_dup(ne) (X509_NAME_ENTRY *)ASN1_dup( \ | |
588 | (int (*)())i2d_X509_NAME_ENTRY, \ | |
589 | (char *(*)())d2i_X509_NAME_ENTRY,\ | |
590 | (char *)ne) | |
591 | ||
592 | #define X509_digest(data,type,md,len) \ | |
593 | ASN1_digest((int (*)())i2d_X509,type,(char *)data,md,len) | |
594 | #define X509_NAME_digest(data,type,md,len) \ | |
595 | ASN1_digest((int (*)())i2d_X509_NAME,type,(char *)data,md,len) | |
596 | #ifndef PKCS7_ISSUER_AND_SERIAL_digest | |
597 | #define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \ | |
598 | ASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\ | |
599 | (char *)data,md,len) | |
600 | #endif | |
601 | #endif | |
602 | ||
603 | #define X509_EXT_PACK_UNKNOWN 1 | |
604 | #define X509_EXT_PACK_STRING 2 | |
605 | ||
606 | #define X509_get_version(x) ASN1_INTEGER_get((x)->cert_info->version) | |
607 | /* #define X509_get_serialNumber(x) ((x)->cert_info->serialNumber) */ | |
608 | #define X509_get_notBefore(x) ((x)->cert_info->validity->notBefore) | |
609 | #define X509_get_notAfter(x) ((x)->cert_info->validity->notAfter) | |
610 | #define X509_extract_key(x) X509_get_pubkey(x) /*****/ | |
611 | #define X509_REQ_get_version(x) ASN1_INTEGER_get((x)->req_info->version) | |
612 | #define X509_REQ_get_subject_name(x) ((x)->req_info->subject) | |
613 | #define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) | |
614 | #define X509_name_cmp(a,b) X509_NAME_cmp((a),(b)) | |
615 | #define X509_get_signature_type(x) EVP_PKEY_type(OBJ_obj2nid((x)->sig_alg->algorithm)) | |
616 | ||
617 | #define X509_CRL_get_version(x) ASN1_INTEGER_get((x)->crl->version) | |
618 | #define X509_CRL_get_lastUpdate(x) ((x)->crl->lastUpdate) | |
619 | #define X509_CRL_get_nextUpdate(x) ((x)->crl->nextUpdate) | |
620 | #define X509_CRL_get_issuer(x) ((x)->crl->issuer) | |
621 | #define X509_CRL_get_REVOKED(x) ((x)->crl->revoked) | |
622 | ||
623 | /* This one is only used so that a binary form can output, as in | |
624 | * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf) */ | |
625 | #define X509_get_X509_PUBKEY(x) ((x)->cert_info->key) | |
626 | ||
627 | ||
628 | const char *X509_verify_cert_error_string(long n); | |
629 | ||
630 | #ifndef SSLEAY_MACROS | |
631 | #ifdef HEADER_ENVELOPE_H | |
632 | int X509_verify(X509 *a, EVP_PKEY *r); | |
633 | ||
634 | int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); | |
635 | int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); | |
636 | int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); | |
637 | ||
638 | NETSCAPE_SPKI * NETSCAPE_SPKI_b64_decode(const char *str, int len); | |
639 | char * NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x); | |
640 | EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x); | |
641 | int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey); | |
642 | ||
643 | int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki); | |
644 | ||
645 | int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); | |
646 | int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); | |
647 | int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); | |
648 | int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); | |
649 | ||
650 | int X509_digest(X509 *data,const EVP_MD *type,unsigned char *md,unsigned int *len); | |
651 | int X509_NAME_digest(X509_NAME *data,const EVP_MD *type, | |
652 | unsigned char *md,unsigned int *len); | |
653 | #endif | |
654 | ||
655 | #ifndef NO_FP_API | |
656 | X509 *d2i_X509_fp(FILE *fp, X509 **x509); | |
657 | int i2d_X509_fp(FILE *fp,X509 *x509); | |
658 | X509_CRL *d2i_X509_CRL_fp(FILE *fp,X509_CRL **crl); | |
659 | int i2d_X509_CRL_fp(FILE *fp,X509_CRL *crl); | |
660 | X509_REQ *d2i_X509_REQ_fp(FILE *fp,X509_REQ **req); | |
661 | int i2d_X509_REQ_fp(FILE *fp,X509_REQ *req); | |
662 | #ifndef NO_RSA | |
663 | RSA *d2i_RSAPrivateKey_fp(FILE *fp,RSA **rsa); | |
664 | int i2d_RSAPrivateKey_fp(FILE *fp,RSA *rsa); | |
665 | RSA *d2i_RSAPublicKey_fp(FILE *fp,RSA **rsa); | |
666 | int i2d_RSAPublicKey_fp(FILE *fp,RSA *rsa); | |
667 | RSA *d2i_RSA_PUBKEY_fp(FILE *fp,RSA **rsa); | |
668 | int i2d_RSA_PUBKEY_fp(FILE *fp,RSA *rsa); | |
669 | #endif | |
670 | #ifndef NO_DSA | |
671 | DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); | |
672 | int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa); | |
673 | DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); | |
674 | int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); | |
675 | #endif | |
676 | X509_SIG *d2i_PKCS8_fp(FILE *fp,X509_SIG **p8); | |
677 | int i2d_PKCS8_fp(FILE *fp,X509_SIG *p8); | |
678 | PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, | |
679 | PKCS8_PRIV_KEY_INFO **p8inf); | |
680 | int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,PKCS8_PRIV_KEY_INFO *p8inf); | |
681 | int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); | |
682 | int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); | |
683 | EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); | |
684 | #endif | |
685 | ||
686 | #ifdef HEADER_BIO_H | |
687 | X509 *d2i_X509_bio(BIO *bp,X509 **x509); | |
688 | int i2d_X509_bio(BIO *bp,X509 *x509); | |
689 | X509_CRL *d2i_X509_CRL_bio(BIO *bp,X509_CRL **crl); | |
690 | int i2d_X509_CRL_bio(BIO *bp,X509_CRL *crl); | |
691 | X509_REQ *d2i_X509_REQ_bio(BIO *bp,X509_REQ **req); | |
692 | int i2d_X509_REQ_bio(BIO *bp,X509_REQ *req); | |
693 | #ifndef NO_RSA | |
694 | RSA *d2i_RSAPrivateKey_bio(BIO *bp,RSA **rsa); | |
695 | int i2d_RSAPrivateKey_bio(BIO *bp,RSA *rsa); | |
696 | RSA *d2i_RSAPublicKey_bio(BIO *bp,RSA **rsa); | |
697 | int i2d_RSAPublicKey_bio(BIO *bp,RSA *rsa); | |
698 | RSA *d2i_RSA_PUBKEY_bio(BIO *bp,RSA **rsa); | |
699 | int i2d_RSA_PUBKEY_bio(BIO *bp,RSA *rsa); | |
700 | #endif | |
701 | #ifndef NO_DSA | |
702 | DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); | |
703 | int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa); | |
704 | DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa); | |
705 | int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa); | |
706 | #endif | |
707 | X509_SIG *d2i_PKCS8_bio(BIO *bp,X509_SIG **p8); | |
708 | int i2d_PKCS8_bio(BIO *bp,X509_SIG *p8); | |
709 | PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, | |
710 | PKCS8_PRIV_KEY_INFO **p8inf); | |
711 | int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,PKCS8_PRIV_KEY_INFO *p8inf); | |
712 | int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); | |
713 | int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); | |
714 | EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); | |
715 | #endif | |
716 | ||
717 | X509 *X509_dup(X509 *x509); | |
718 | X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa); | |
719 | X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex); | |
720 | X509_CRL *X509_CRL_dup(X509_CRL *crl); | |
721 | X509_REQ *X509_REQ_dup(X509_REQ *req); | |
722 | X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn); | |
723 | X509_NAME *X509_NAME_dup(X509_NAME *xn); | |
724 | X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne); | |
725 | #ifndef NO_RSA | |
726 | RSA *RSAPublicKey_dup(RSA *rsa); | |
727 | RSA *RSAPrivateKey_dup(RSA *rsa); | |
728 | #endif | |
729 | ||
730 | #endif /* !SSLEAY_MACROS */ | |
731 | ||
732 | int X509_cmp_current_time(ASN1_UTCTIME *s); | |
733 | ASN1_UTCTIME * X509_gmtime_adj(ASN1_UTCTIME *s, long adj); | |
734 | ||
735 | const char * X509_get_default_cert_area(void ); | |
736 | const char * X509_get_default_cert_dir(void ); | |
737 | const char * X509_get_default_cert_file(void ); | |
738 | const char * X509_get_default_cert_dir_env(void ); | |
739 | const char * X509_get_default_cert_file_env(void ); | |
740 | const char * X509_get_default_private_dir(void ); | |
741 | ||
742 | X509_REQ * X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); | |
743 | X509 * X509_REQ_to_X509(X509_REQ *r, int days,EVP_PKEY *pkey); | |
744 | void ERR_load_X509_strings(void ); | |
745 | ||
746 | X509_ALGOR * X509_ALGOR_new(void ); | |
747 | void X509_ALGOR_free(X509_ALGOR *a); | |
748 | int i2d_X509_ALGOR(X509_ALGOR *a,unsigned char **pp); | |
749 | X509_ALGOR * d2i_X509_ALGOR(X509_ALGOR **a,unsigned char **pp, | |
750 | long length); | |
751 | ||
752 | X509_VAL * X509_VAL_new(void ); | |
753 | void X509_VAL_free(X509_VAL *a); | |
754 | int i2d_X509_VAL(X509_VAL *a,unsigned char **pp); | |
755 | X509_VAL * d2i_X509_VAL(X509_VAL **a,unsigned char **pp, | |
756 | long length); | |
757 | ||
758 | X509_PUBKEY * X509_PUBKEY_new(void ); | |
759 | void X509_PUBKEY_free(X509_PUBKEY *a); | |
760 | int i2d_X509_PUBKEY(X509_PUBKEY *a,unsigned char **pp); | |
761 | X509_PUBKEY * d2i_X509_PUBKEY(X509_PUBKEY **a,unsigned char **pp, | |
762 | long length); | |
763 | int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); | |
764 | EVP_PKEY * X509_PUBKEY_get(X509_PUBKEY *key); | |
765 | int X509_get_pubkey_parameters(EVP_PKEY *pkey, | |
766 | STACK_OF(X509) *chain); | |
767 | int i2d_PUBKEY(EVP_PKEY *a,unsigned char **pp); | |
768 | EVP_PKEY * d2i_PUBKEY(EVP_PKEY **a,unsigned char **pp, | |
769 | long length); | |
770 | #ifndef NO_RSA | |
771 | int i2d_RSA_PUBKEY(RSA *a,unsigned char **pp); | |
772 | RSA * d2i_RSA_PUBKEY(RSA **a,unsigned char **pp, | |
773 | long length); | |
774 | #endif | |
775 | #ifndef NO_DSA | |
776 | int i2d_DSA_PUBKEY(DSA *a,unsigned char **pp); | |
777 | DSA * d2i_DSA_PUBKEY(DSA **a,unsigned char **pp, | |
778 | long length); | |
779 | #endif | |
780 | ||
781 | X509_SIG * X509_SIG_new(void ); | |
782 | void X509_SIG_free(X509_SIG *a); | |
783 | int i2d_X509_SIG(X509_SIG *a,unsigned char **pp); | |
784 | X509_SIG * d2i_X509_SIG(X509_SIG **a,unsigned char **pp,long length); | |
785 | ||
786 | X509_REQ_INFO *X509_REQ_INFO_new(void); | |
787 | void X509_REQ_INFO_free(X509_REQ_INFO *a); | |
788 | int i2d_X509_REQ_INFO(X509_REQ_INFO *a,unsigned char **pp); | |
789 | X509_REQ_INFO *d2i_X509_REQ_INFO(X509_REQ_INFO **a,unsigned char **pp, | |
790 | long length); | |
791 | ||
792 | X509_REQ * X509_REQ_new(void); | |
793 | void X509_REQ_free(X509_REQ *a); | |
794 | int i2d_X509_REQ(X509_REQ *a,unsigned char **pp); | |
795 | X509_REQ * d2i_X509_REQ(X509_REQ **a,unsigned char **pp,long length); | |
796 | ||
797 | X509_ATTRIBUTE *X509_ATTRIBUTE_new(void ); | |
798 | void X509_ATTRIBUTE_free(X509_ATTRIBUTE *a); | |
799 | int i2d_X509_ATTRIBUTE(X509_ATTRIBUTE *a,unsigned char **pp); | |
800 | X509_ATTRIBUTE *d2i_X509_ATTRIBUTE(X509_ATTRIBUTE **a,unsigned char **pp, | |
801 | long length); | |
802 | X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value); | |
803 | ||
804 | ||
805 | X509_EXTENSION *X509_EXTENSION_new(void ); | |
806 | void X509_EXTENSION_free(X509_EXTENSION *a); | |
807 | int i2d_X509_EXTENSION(X509_EXTENSION *a,unsigned char **pp); | |
808 | X509_EXTENSION *d2i_X509_EXTENSION(X509_EXTENSION **a,unsigned char **pp, | |
809 | long length); | |
810 | ||
811 | X509_NAME_ENTRY *X509_NAME_ENTRY_new(void); | |
812 | void X509_NAME_ENTRY_free(X509_NAME_ENTRY *a); | |
813 | int i2d_X509_NAME_ENTRY(X509_NAME_ENTRY *a,unsigned char **pp); | |
814 | X509_NAME_ENTRY *d2i_X509_NAME_ENTRY(X509_NAME_ENTRY **a,unsigned char **pp, | |
815 | long length); | |
816 | ||
817 | X509_NAME * X509_NAME_new(void); | |
818 | void X509_NAME_free(X509_NAME *a); | |
819 | int i2d_X509_NAME(X509_NAME *a,unsigned char **pp); | |
820 | X509_NAME * d2i_X509_NAME(X509_NAME **a,unsigned char **pp,long length); | |
821 | int X509_NAME_set(X509_NAME **xn, X509_NAME *name); | |
822 | ||
823 | ||
824 | X509_CINF * X509_CINF_new(void); | |
825 | void X509_CINF_free(X509_CINF *a); | |
826 | int i2d_X509_CINF(X509_CINF *a,unsigned char **pp); | |
827 | X509_CINF * d2i_X509_CINF(X509_CINF **a,unsigned char **pp,long length); | |
828 | ||
829 | X509 * X509_new(void); | |
830 | void X509_free(X509 *a); | |
831 | int i2d_X509(X509 *a,unsigned char **pp); | |
832 | X509 * d2i_X509(X509 **a,unsigned char **pp,long length); | |
833 | int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | |
834 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); | |
835 | int X509_set_ex_data(X509 *r, int idx, void *arg); | |
836 | void *X509_get_ex_data(X509 *r, int idx); | |
837 | int i2d_X509_AUX(X509 *a,unsigned char **pp); | |
838 | X509 * d2i_X509_AUX(X509 **a,unsigned char **pp,long length); | |
839 | ||
840 | X509_CERT_AUX * X509_CERT_AUX_new(void); | |
841 | void X509_CERT_AUX_free(X509_CERT_AUX *a); | |
842 | int i2d_X509_CERT_AUX(X509_CERT_AUX *a,unsigned char **pp); | |
843 | X509_CERT_AUX * d2i_X509_CERT_AUX(X509_CERT_AUX **a,unsigned char **pp, | |
844 | long length); | |
845 | int X509_alias_set1(X509 *x, unsigned char *name, int len); | |
846 | unsigned char * X509_alias_get0(X509 *x, int *len); | |
847 | int (*X509_TRUST_set_default(int (*trust)(int , X509 *, int)))(int, X509 *, int); | |
848 | int X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj); | |
849 | int X509_add1_reject_object(X509 *x, ASN1_OBJECT *obj); | |
850 | void X509_trust_clear(X509 *x); | |
851 | void X509_reject_clear(X509 *x); | |
852 | ||
853 | X509_REVOKED * X509_REVOKED_new(void); | |
854 | void X509_REVOKED_free(X509_REVOKED *a); | |
855 | int i2d_X509_REVOKED(X509_REVOKED *a,unsigned char **pp); | |
856 | X509_REVOKED * d2i_X509_REVOKED(X509_REVOKED **a,unsigned char **pp,long length); | |
857 | ||
858 | X509_CRL_INFO *X509_CRL_INFO_new(void); | |
859 | void X509_CRL_INFO_free(X509_CRL_INFO *a); | |
860 | int i2d_X509_CRL_INFO(X509_CRL_INFO *a,unsigned char **pp); | |
861 | X509_CRL_INFO *d2i_X509_CRL_INFO(X509_CRL_INFO **a,unsigned char **pp, | |
862 | long length); | |
863 | ||
864 | X509_CRL * X509_CRL_new(void); | |
865 | void X509_CRL_free(X509_CRL *a); | |
866 | int i2d_X509_CRL(X509_CRL *a,unsigned char **pp); | |
867 | X509_CRL * d2i_X509_CRL(X509_CRL **a,unsigned char **pp,long length); | |
868 | ||
869 | X509_PKEY * X509_PKEY_new(void ); | |
870 | void X509_PKEY_free(X509_PKEY *a); | |
871 | int i2d_X509_PKEY(X509_PKEY *a,unsigned char **pp); | |
872 | X509_PKEY * d2i_X509_PKEY(X509_PKEY **a,unsigned char **pp,long length); | |
873 | ||
874 | NETSCAPE_SPKI * NETSCAPE_SPKI_new(void ); | |
875 | void NETSCAPE_SPKI_free(NETSCAPE_SPKI *a); | |
876 | int i2d_NETSCAPE_SPKI(NETSCAPE_SPKI *a,unsigned char **pp); | |
877 | NETSCAPE_SPKI * d2i_NETSCAPE_SPKI(NETSCAPE_SPKI **a,unsigned char **pp, | |
878 | long length); | |
879 | ||
880 | NETSCAPE_SPKAC *NETSCAPE_SPKAC_new(void ); | |
881 | void NETSCAPE_SPKAC_free(NETSCAPE_SPKAC *a); | |
882 | int i2d_NETSCAPE_SPKAC(NETSCAPE_SPKAC *a,unsigned char **pp); | |
883 | NETSCAPE_SPKAC *d2i_NETSCAPE_SPKAC(NETSCAPE_SPKAC **a,unsigned char **pp, | |
884 | long length); | |
885 | ||
886 | ||
887 | int i2d_NETSCAPE_CERT_SEQUENCE(NETSCAPE_CERT_SEQUENCE *a, unsigned char **pp); | |
888 | NETSCAPE_CERT_SEQUENCE *NETSCAPE_CERT_SEQUENCE_new(void); | |
889 | NETSCAPE_CERT_SEQUENCE *d2i_NETSCAPE_CERT_SEQUENCE(NETSCAPE_CERT_SEQUENCE **a, unsigned char **pp, long length); | |
890 | void NETSCAPE_CERT_SEQUENCE_free(NETSCAPE_CERT_SEQUENCE *a); | |
891 | ||
892 | #ifdef HEADER_ENVELOPE_H | |
893 | X509_INFO * X509_INFO_new(void); | |
894 | void X509_INFO_free(X509_INFO *a); | |
895 | char * X509_NAME_oneline(X509_NAME *a,char *buf,int size); | |
896 | ||
897 | int ASN1_verify(int (*i2d)(), X509_ALGOR *algor1, | |
898 | ASN1_BIT_STRING *signature,char *data,EVP_PKEY *pkey); | |
899 | ||
900 | int ASN1_digest(int (*i2d)(),const EVP_MD *type,char *data, | |
901 | unsigned char *md,unsigned int *len); | |
902 | ||
903 | int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2, | |
904 | ASN1_BIT_STRING *signature, | |
905 | char *data,EVP_PKEY *pkey, const EVP_MD *type); | |
906 | #endif | |
907 | ||
908 | int X509_set_version(X509 *x,long version); | |
909 | int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial); | |
910 | ASN1_INTEGER * X509_get_serialNumber(X509 *x); | |
911 | int X509_set_issuer_name(X509 *x, X509_NAME *name); | |
912 | X509_NAME * X509_get_issuer_name(X509 *a); | |
913 | int X509_set_subject_name(X509 *x, X509_NAME *name); | |
914 | X509_NAME * X509_get_subject_name(X509 *a); | |
915 | int X509_set_notBefore(X509 *x, ASN1_UTCTIME *tm); | |
916 | int X509_set_notAfter(X509 *x, ASN1_UTCTIME *tm); | |
917 | int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); | |
918 | EVP_PKEY * X509_get_pubkey(X509 *x); | |
919 | int X509_certificate_type(X509 *x,EVP_PKEY *pubkey /* optional */); | |
920 | ||
921 | int X509_REQ_set_version(X509_REQ *x,long version); | |
922 | int X509_REQ_set_subject_name(X509_REQ *req,X509_NAME *name); | |
923 | int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); | |
924 | EVP_PKEY * X509_REQ_get_pubkey(X509_REQ *req); | |
925 | int X509_REQ_extension_nid(int nid); | |
926 | int * X509_REQ_get_extension_nids(void); | |
927 | void X509_REQ_set_extension_nids(int *nids); | |
928 | STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req); | |
929 | int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, | |
930 | int nid); | |
931 | int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts); | |
932 | int X509_REQ_get_attr_count(const X509_REQ *req); | |
933 | int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, | |
934 | int lastpos); | |
935 | int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, ASN1_OBJECT *obj, | |
936 | int lastpos); | |
937 | X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc); | |
938 | X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc); | |
939 | int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr); | |
940 | int X509_REQ_add1_attr_by_OBJ(X509_REQ *req, | |
941 | ASN1_OBJECT *obj, int type, | |
942 | unsigned char *bytes, int len); | |
943 | int X509_REQ_add1_attr_by_NID(X509_REQ *req, | |
944 | int nid, int type, | |
945 | unsigned char *bytes, int len); | |
946 | int X509_REQ_add1_attr_by_txt(X509_REQ *req, | |
947 | char *attrname, int type, | |
948 | unsigned char *bytes, int len); | |
949 | ||
950 | int X509_check_private_key(X509 *x509,EVP_PKEY *pkey); | |
951 | ||
952 | int X509_issuer_and_serial_cmp(X509 *a, X509 *b); | |
953 | unsigned long X509_issuer_and_serial_hash(X509 *a); | |
954 | ||
955 | int X509_issuer_name_cmp(X509 *a, X509 *b); | |
956 | unsigned long X509_issuer_name_hash(X509 *a); | |
957 | ||
958 | int X509_subject_name_cmp(X509 *a,X509 *b); | |
959 | unsigned long X509_subject_name_hash(X509 *x); | |
960 | ||
961 | int X509_cmp (X509 *a, X509 *b); | |
962 | int X509_NAME_cmp (X509_NAME *a, X509_NAME *b); | |
963 | unsigned long X509_NAME_hash(X509_NAME *x); | |
964 | ||
965 | int X509_CRL_cmp(X509_CRL *a,X509_CRL *b); | |
966 | #ifndef NO_FP_API | |
967 | int X509_print_fp(FILE *bp,X509 *x); | |
968 | int X509_CRL_print_fp(FILE *bp,X509_CRL *x); | |
969 | int X509_REQ_print_fp(FILE *bp,X509_REQ *req); | |
970 | #endif | |
971 | ||
972 | #ifdef HEADER_BIO_H | |
973 | int X509_NAME_print(BIO *bp, X509_NAME *name, int obase); | |
974 | int X509_print(BIO *bp,X509 *x); | |
975 | int X509_CERT_AUX_print(BIO *bp,X509_CERT_AUX *x, int indent); | |
976 | int X509_CRL_print(BIO *bp,X509_CRL *x); | |
977 | int X509_REQ_print(BIO *bp,X509_REQ *req); | |
978 | #endif | |
979 | ||
980 | int X509_NAME_entry_count(X509_NAME *name); | |
981 | int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, | |
982 | char *buf,int len); | |
983 | int X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, | |
984 | char *buf,int len); | |
985 | ||
986 | /* NOTE: you should be passsing -1, not 0 as lastpos. The functions that use | |
987 | * lastpos, search after that position on. */ | |
988 | int X509_NAME_get_index_by_NID(X509_NAME *name,int nid,int lastpos); | |
989 | int X509_NAME_get_index_by_OBJ(X509_NAME *name,ASN1_OBJECT *obj, | |
990 | int lastpos); | |
991 | X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc); | |
992 | X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); | |
993 | int X509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne, | |
994 | int loc, int set); | |
995 | int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type, | |
996 | unsigned char *bytes, int len, int loc, int set); | |
997 | int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, | |
998 | unsigned char *bytes, int len, int loc, int set); | |
999 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, | |
1000 | char *field, int type, unsigned char *bytes, int len); | |
1001 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, | |
1002 | int type,unsigned char *bytes, int len); | |
1003 | int X509_NAME_add_entry_by_txt(X509_NAME *name, char *field, int type, | |
1004 | unsigned char *bytes, int len, int loc, int set); | |
1005 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, | |
1006 | ASN1_OBJECT *obj, int type,unsigned char *bytes, | |
1007 | int len); | |
1008 | int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, | |
1009 | ASN1_OBJECT *obj); | |
1010 | int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, | |
1011 | unsigned char *bytes, int len); | |
1012 | ASN1_OBJECT * X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne); | |
1013 | ASN1_STRING * X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne); | |
1014 | ||
1015 | int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x); | |
1016 | int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, | |
1017 | int nid, int lastpos); | |
1018 | int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x, | |
1019 | ASN1_OBJECT *obj,int lastpos); | |
1020 | int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x, | |
1021 | int crit, int lastpos); | |
1022 | X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc); | |
1023 | X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc); | |
1024 | STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, | |
1025 | X509_EXTENSION *ex, int loc); | |
1026 | ||
1027 | int X509_get_ext_count(X509 *x); | |
1028 | int X509_get_ext_by_NID(X509 *x, int nid, int lastpos); | |
1029 | int X509_get_ext_by_OBJ(X509 *x,ASN1_OBJECT *obj,int lastpos); | |
1030 | int X509_get_ext_by_critical(X509 *x, int crit, int lastpos); | |
1031 | X509_EXTENSION *X509_get_ext(X509 *x, int loc); | |
1032 | X509_EXTENSION *X509_delete_ext(X509 *x, int loc); | |
1033 | int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc); | |
1034 | void * X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx); | |
1035 | ||
1036 | int X509_CRL_get_ext_count(X509_CRL *x); | |
1037 | int X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos); | |
1038 | int X509_CRL_get_ext_by_OBJ(X509_CRL *x,ASN1_OBJECT *obj,int lastpos); | |
1039 | int X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos); | |
1040 | X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc); | |
1041 | X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); | |
1042 | int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc); | |
1043 | void * X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx); | |
1044 | ||
1045 | int X509_REVOKED_get_ext_count(X509_REVOKED *x); | |
1046 | int X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos); | |
1047 | int X509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x,ASN1_OBJECT *obj,int lastpos); | |
1048 | int X509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int lastpos); | |
1049 | X509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc); | |
1050 | X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); | |
1051 | int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc); | |
1052 | void * X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx); | |
1053 | ||
1054 | X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, | |
1055 | int nid, int crit, ASN1_OCTET_STRING *data); | |
1056 | X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, | |
1057 | ASN1_OBJECT *obj,int crit,ASN1_OCTET_STRING *data); | |
1058 | int X509_EXTENSION_set_object(X509_EXTENSION *ex,ASN1_OBJECT *obj); | |
1059 | int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit); | |
1060 | int X509_EXTENSION_set_data(X509_EXTENSION *ex, | |
1061 | ASN1_OCTET_STRING *data); | |
1062 | ASN1_OBJECT * X509_EXTENSION_get_object(X509_EXTENSION *ex); | |
1063 | ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); | |
1064 | int X509_EXTENSION_get_critical(X509_EXTENSION *ex); | |
1065 | ||
1066 | int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x); | |
1067 | int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, | |
1068 | int lastpos); | |
1069 | int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, ASN1_OBJECT *obj, | |
1070 | int lastpos); | |
1071 | X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc); | |
1072 | X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc); | |
1073 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, | |
1074 | X509_ATTRIBUTE *attr); | |
1075 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) **x, | |
1076 | ASN1_OBJECT *obj, int type, | |
1077 | unsigned char *bytes, int len); | |
1078 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) **x, | |
1079 | int nid, int type, | |
1080 | unsigned char *bytes, int len); | |
1081 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) **x, | |
1082 | char *attrname, int type, | |
1083 | unsigned char *bytes, int len); | |
1084 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, | |
1085 | int atrtype, void *data, int len); | |
1086 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, | |
1087 | ASN1_OBJECT *obj, int atrtype, void *data, int len); | |
1088 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, | |
1089 | char *atrname, int type, unsigned char *bytes, int len); | |
1090 | int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, ASN1_OBJECT *obj); | |
1091 | int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, void *data, int len); | |
1092 | void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, | |
1093 | int atrtype, void *data); | |
1094 | int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr); | |
1095 | ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr); | |
1096 | ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx); | |
1097 | ||
1098 | int X509_verify_cert(X509_STORE_CTX *ctx); | |
1099 | ||
1100 | /* lookup a cert from a X509 STACK */ | |
1101 | X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk,X509_NAME *name, | |
1102 | ASN1_INTEGER *serial); | |
1103 | X509 *X509_find_by_subject(STACK_OF(X509) *sk,X509_NAME *name); | |
1104 | ||
1105 | int i2d_PBEPARAM(PBEPARAM *a, unsigned char **pp); | |
1106 | PBEPARAM *PBEPARAM_new(void); | |
1107 | PBEPARAM *d2i_PBEPARAM(PBEPARAM **a, unsigned char **pp, long length); | |
1108 | void PBEPARAM_free(PBEPARAM *a); | |
1109 | X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, int saltlen); | |
1110 | X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, | |
1111 | unsigned char *salt, int saltlen); | |
1112 | ||
1113 | int i2d_PBKDF2PARAM(PBKDF2PARAM *a, unsigned char **pp); | |
1114 | PBKDF2PARAM *PBKDF2PARAM_new(void); | |
1115 | PBKDF2PARAM *d2i_PBKDF2PARAM(PBKDF2PARAM **a, unsigned char **pp, long length); | |
1116 | void PBKDF2PARAM_free(PBKDF2PARAM *a); | |
1117 | ||
1118 | int i2d_PBE2PARAM(PBE2PARAM *a, unsigned char **pp); | |
1119 | PBE2PARAM *PBE2PARAM_new(void); | |
1120 | PBE2PARAM *d2i_PBE2PARAM(PBE2PARAM **a, unsigned char **pp, long length); | |
1121 | void PBE2PARAM_free(PBE2PARAM *a); | |
1122 | ||
1123 | /* PKCS#8 utilities */ | |
1124 | ||
1125 | int i2d_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO *a, unsigned char **pp); | |
1126 | PKCS8_PRIV_KEY_INFO *PKCS8_PRIV_KEY_INFO_new(void); | |
1127 | PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO **a, | |
1128 | unsigned char **pp, long length); | |
1129 | void PKCS8_PRIV_KEY_INFO_free(PKCS8_PRIV_KEY_INFO *a); | |
1130 | ||
1131 | EVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8); | |
1132 | PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey); | |
1133 | PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken); | |
1134 | PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken); | |
1135 | ||
1136 | int X509_check_trust(X509 *x, int id, int flags); | |
1137 | int X509_TRUST_get_count(void); | |
1138 | X509_TRUST * X509_TRUST_get0(int idx); | |
1139 | int X509_TRUST_get_by_id(int id); | |
1140 | int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int), | |
1141 | char *name, int arg1, void *arg2); | |
1142 | void X509_TRUST_cleanup(void); | |
1143 | int X509_TRUST_get_flags(X509_TRUST *xp); | |
1144 | char *X509_TRUST_get0_name(X509_TRUST *xp); | |
1145 | int X509_TRUST_get_trust(X509_TRUST *xp); | |
1146 | ||
1147 | /* BEGIN ERROR CODES */ | |
1148 | /* The following lines are auto generated by the script mkerr.pl. Any changes | |
1149 | * made after this point may be overwritten when the script is next run. | |
1150 | */ | |
1151 | ||
1152 | /* Error codes for the X509 functions. */ | |
1153 | ||
1154 | /* Function codes. */ | |
1155 | #define X509_F_ADD_CERT_DIR 100 | |
1156 | #define X509_F_BY_FILE_CTRL 101 | |
1157 | #define X509_F_DIR_CTRL 102 | |
1158 | #define X509_F_GET_CERT_BY_SUBJECT 103 | |
1159 | #define X509_F_NETSCAPE_SPKI_B64_DECODE 129 | |
1160 | #define X509_F_NETSCAPE_SPKI_B64_ENCODE 130 | |
1161 | #define X509_F_X509V3_ADD_EXT 104 | |
1162 | #define X509_F_X509_ADD_ATTR 135 | |
1163 | #define X509_F_X509_ATTRIBUTE_CREATE_BY_NID 136 | |
1164 | #define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 137 | |
1165 | #define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 140 | |
1166 | #define X509_F_X509_ATTRIBUTE_GET0_DATA 139 | |
1167 | #define X509_F_X509_ATTRIBUTE_SET1_DATA 138 | |
1168 | #define X509_F_X509_CHECK_PRIVATE_KEY 128 | |
1169 | #define X509_F_X509_EXTENSION_CREATE_BY_NID 108 | |
1170 | #define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 | |
1171 | #define X509_F_X509_GET_PUBKEY_PARAMETERS 110 | |
1172 | #define X509_F_X509_LOAD_CERT_CRL_FILE 132 | |
1173 | #define X509_F_X509_LOAD_CERT_FILE 111 | |
1174 | #define X509_F_X509_LOAD_CRL_FILE 112 | |
1175 | #define X509_F_X509_NAME_ADD_ENTRY 113 | |
1176 | #define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 | |
1177 | #define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT 131 | |
1178 | #define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 | |
1179 | #define X509_F_X509_NAME_ONELINE 116 | |
1180 | #define X509_F_X509_NAME_PRINT 117 | |
1181 | #define X509_F_X509_PRINT_FP 118 | |
1182 | #define X509_F_X509_PUBKEY_GET 119 | |
1183 | #define X509_F_X509_PUBKEY_SET 120 | |
1184 | #define X509_F_X509_REQ_PRINT 121 | |
1185 | #define X509_F_X509_REQ_PRINT_FP 122 | |
1186 | #define X509_F_X509_REQ_TO_X509 123 | |
1187 | #define X509_F_X509_STORE_ADD_CERT 124 | |
1188 | #define X509_F_X509_STORE_ADD_CRL 125 | |
1189 | #define X509_F_X509_STORE_CTX_PURPOSE_INHERIT 134 | |
1190 | #define X509_F_X509_TO_X509_REQ 126 | |
1191 | #define X509_F_X509_TRUST_ADD 133 | |
1192 | #define X509_F_X509_VERIFY_CERT 127 | |
1193 | ||
1194 | /* Reason codes. */ | |
1195 | #define X509_R_BAD_X509_FILETYPE 100 | |
1196 | #define X509_R_BASE64_DECODE_ERROR 118 | |
1197 | #define X509_R_CANT_CHECK_DH_KEY 114 | |
1198 | #define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 | |
1199 | #define X509_R_ERR_ASN1_LIB 102 | |
1200 | #define X509_R_INVALID_DIRECTORY 113 | |
1201 | #define X509_R_INVALID_FIELD_NAME 119 | |
1202 | #define X509_R_KEY_TYPE_MISMATCH 115 | |
1203 | #define X509_R_KEY_VALUES_MISMATCH 116 | |
1204 | #define X509_R_LOADING_CERT_DIR 103 | |
1205 | #define X509_R_LOADING_DEFAULTS 104 | |
1206 | #define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 | |
1207 | #define X509_R_SHOULD_RETRY 106 | |
1208 | #define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 | |
1209 | #define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 | |
1210 | #define X509_R_UNKNOWN_KEY_TYPE 117 | |
1211 | #define X509_R_UNKNOWN_NID 109 | |
1212 | #define X509_R_UNKNOWN_PURPOSE_ID 121 | |
1213 | #define X509_R_UNKNOWN_TRUST_ID 120 | |
1214 | #define X509_R_UNSUPPORTED_ALGORITHM 111 | |
1215 | #define X509_R_WRONG_LOOKUP_TYPE 112 | |
1216 | #define X509_R_WRONG_TYPE 122 | |
1217 | ||
1218 | #ifdef __cplusplus | |
1219 | } | |
1220 | #endif | |
1221 | #endif | |
1222 |