diff options
author | ryker <> | 1998-10-05 20:13:14 +0000 |
---|---|---|
committer | ryker <> | 1998-10-05 20:13:14 +0000 |
commit | aeeae06a79815dc190061534d47236cec09f9e32 (patch) | |
tree | 851692b9c2f9c04f077666855641900f19fdb217 /src/lib/libcrypto/x509/x509.h | |
parent | a4f79641824cbf9f60ca9d1168d1fcc46717a82a (diff) | |
download | openbsd-aeeae06a79815dc190061534d47236cec09f9e32.tar.gz openbsd-aeeae06a79815dc190061534d47236cec09f9e32.tar.bz2 openbsd-aeeae06a79815dc190061534d47236cec09f9e32.zip |
Import of SSLeay-0.9.0b with RSA and IDEA stubbed + OpenBSD build
functionality for shared libs.
Note that routines such as sslv2_init and friends that use RSA will
not work due to lack of RSA in this library.
Needs documentation and help from ports for easy upgrade to full
functionality where legally possible.
Diffstat (limited to 'src/lib/libcrypto/x509/x509.h')
-rw-r--r-- | src/lib/libcrypto/x509/x509.h | 1152 |
1 files changed, 1152 insertions, 0 deletions
diff --git a/src/lib/libcrypto/x509/x509.h b/src/lib/libcrypto/x509/x509.h new file mode 100644 index 0000000000..95114f7c43 --- /dev/null +++ b/src/lib/libcrypto/x509/x509.h | |||
@@ -0,0 +1,1152 @@ | |||
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 | #ifndef HEADER_X509_H | ||
60 | #define HEADER_X509_H | ||
61 | |||
62 | #ifdef __cplusplus | ||
63 | extern "C" { | ||
64 | #endif | ||
65 | |||
66 | #include "stack.h" | ||
67 | #include "asn1.h" | ||
68 | |||
69 | #ifndef NO_RSA | ||
70 | #include "rsa.h" | ||
71 | #else | ||
72 | #define RSA long | ||
73 | #endif | ||
74 | |||
75 | #ifndef NO_DSA | ||
76 | #include "dsa.h" | ||
77 | #else | ||
78 | #define DSA long | ||
79 | #endif | ||
80 | |||
81 | #ifndef NO_DH | ||
82 | #include "dh.h" | ||
83 | #else | ||
84 | #define DH long | ||
85 | #endif | ||
86 | |||
87 | #include "evp.h" | ||
88 | |||
89 | #define X509_FILETYPE_PEM 1 | ||
90 | #define X509_FILETYPE_ASN1 2 | ||
91 | #define X509_FILETYPE_DEFAULT 3 | ||
92 | |||
93 | #define X509v3_KU_DIGITAL_SIGNATURE 0x0080 | ||
94 | #define X509v3_KU_NON_REPUDIATION 0x0040 | ||
95 | #define X509v3_KU_KEY_ENCIPHERMENT 0x0020 | ||
96 | #define X509v3_KU_DATA_ENCIPHERMENT 0x0010 | ||
97 | #define X509v3_KU_KEY_AGREEMENT 0x0008 | ||
98 | #define X509v3_KU_KEY_CERT_SIGN 0x0004 | ||
99 | #define X509v3_KU_CRL_SIGN 0x0002 | ||
100 | #define X509v3_KU_ENCIPHER_ONLY 0x0001 | ||
101 | #define X509v3_KU_DECIPHER_ONLY 0x8000 | ||
102 | #define X509v3_KU_UNDEF 0xffff | ||
103 | |||
104 | typedef struct X509_objects_st | ||
105 | { | ||
106 | int nid; | ||
107 | int (*a2i)(); | ||
108 | int (*i2a)(); | ||
109 | } X509_OBJECTS; | ||
110 | |||
111 | typedef struct X509_algor_st | ||
112 | { | ||
113 | ASN1_OBJECT *algorithm; | ||
114 | ASN1_TYPE *parameter; | ||
115 | } X509_ALGOR; | ||
116 | |||
117 | typedef struct X509_val_st | ||
118 | { | ||
119 | ASN1_UTCTIME *notBefore; | ||
120 | ASN1_UTCTIME *notAfter; | ||
121 | } X509_VAL; | ||
122 | |||
123 | typedef struct X509_pubkey_st | ||
124 | { | ||
125 | X509_ALGOR *algor; | ||
126 | ASN1_BIT_STRING *public_key; | ||
127 | struct evp_pkey_st /* EVP_PKEY*/ *pkey; | ||
128 | } X509_PUBKEY; | ||
129 | |||
130 | typedef struct X509_sig_st | ||
131 | { | ||
132 | X509_ALGOR *algor; | ||
133 | ASN1_OCTET_STRING *digest; | ||
134 | } X509_SIG; | ||
135 | |||
136 | typedef struct X509_name_entry_st | ||
137 | { | ||
138 | ASN1_OBJECT *object; | ||
139 | ASN1_STRING *value; | ||
140 | int set; | ||
141 | int size; /* temp variable */ | ||
142 | } X509_NAME_ENTRY; | ||
143 | |||
144 | /* we always keep X509_NAMEs in 2 forms. */ | ||
145 | typedef struct X509_name_st | ||
146 | { | ||
147 | STACK *entries; /* of X509_NAME_ENTRY */ | ||
148 | int modified; /* true if 'bytes' needs to be built */ | ||
149 | #ifdef HEADER_BUFFER_H | ||
150 | BUF_MEM *bytes; | ||
151 | #else | ||
152 | char *bytes; | ||
153 | #endif | ||
154 | unsigned long hash; /* Keep the hash around for lookups */ | ||
155 | } X509_NAME; | ||
156 | |||
157 | #define X509_EX_V_NETSCAPE_HACK 0x8000 | ||
158 | #define X509_EX_V_INIT 0x0001 | ||
159 | typedef struct X509_extension_st | ||
160 | { | ||
161 | ASN1_OBJECT *object; | ||
162 | short critical; | ||
163 | short netscape_hack; | ||
164 | ASN1_OCTET_STRING *value; | ||
165 | long argl; /* used when decoding */ | ||
166 | char *argp; /* used when decoding */ | ||
167 | void (*ex_free)(); /* clear argp stuff */ | ||
168 | } X509_EXTENSION; | ||
169 | |||
170 | /* #if 1 */ | ||
171 | typedef struct x509_extension_method_st | ||
172 | { | ||
173 | int nid; | ||
174 | int data_type; | ||
175 | int pack_type; | ||
176 | void (*ex_clear)(); | ||
177 | int (*ex_get_bool)(); | ||
178 | int (*ex_set_bool)(); | ||
179 | int (*ex_get_str)(); | ||
180 | int (*ex_set_str)(); | ||
181 | char *(*ex_get_struct)(); | ||
182 | int (*ex_set_struct)(); | ||
183 | int (*a2i)(); | ||
184 | int (*i2a)(); | ||
185 | } X509_EXTENSION_METHOD; | ||
186 | /* #endif */ | ||
187 | |||
188 | typedef struct X509_req_info_st | ||
189 | { | ||
190 | ASN1_INTEGER *version; | ||
191 | X509_NAME *subject; | ||
192 | X509_PUBKEY *pubkey; | ||
193 | /* d=2 hl=2 l= 0 cons: cont: 00 */ | ||
194 | STACK /* X509_ATTRIBUTE */ *attributes; /* [ 0 ] */ | ||
195 | int req_kludge; | ||
196 | } X509_REQ_INFO; | ||
197 | |||
198 | typedef struct X509_req_st | ||
199 | { | ||
200 | X509_REQ_INFO *req_info; | ||
201 | X509_ALGOR *sig_alg; | ||
202 | ASN1_BIT_STRING *signature; | ||
203 | int references; | ||
204 | } X509_REQ; | ||
205 | |||
206 | typedef struct x509_cinf_st | ||
207 | { | ||
208 | ASN1_INTEGER *version; /* [ 0 ] default of v1 */ | ||
209 | ASN1_INTEGER *serialNumber; | ||
210 | X509_ALGOR *signature; | ||
211 | X509_NAME *issuer; | ||
212 | X509_VAL *validity; | ||
213 | X509_NAME *subject; | ||
214 | X509_PUBKEY *key; | ||
215 | ASN1_BIT_STRING *issuerUID; /* [ 1 ] optional in v2 */ | ||
216 | ASN1_BIT_STRING *subjectUID; /* [ 2 ] optional in v2 */ | ||
217 | STACK /* X509_EXTENSION */ *extensions; /* [ 3 ] optional in v3 */ | ||
218 | } X509_CINF; | ||
219 | |||
220 | typedef struct x509_st | ||
221 | { | ||
222 | X509_CINF *cert_info; | ||
223 | X509_ALGOR *sig_alg; | ||
224 | ASN1_BIT_STRING *signature; | ||
225 | int valid; | ||
226 | int references; | ||
227 | char *name; | ||
228 | } X509; | ||
229 | |||
230 | typedef struct X509_revoked_st | ||
231 | { | ||
232 | ASN1_INTEGER *serialNumber; | ||
233 | ASN1_UTCTIME *revocationDate; | ||
234 | STACK /* optional X509_EXTENSION */ *extensions; | ||
235 | int sequence; /* load sequence */ | ||
236 | } X509_REVOKED; | ||
237 | |||
238 | typedef struct X509_crl_info_st | ||
239 | { | ||
240 | ASN1_INTEGER *version; | ||
241 | X509_ALGOR *sig_alg; | ||
242 | X509_NAME *issuer; | ||
243 | ASN1_UTCTIME *lastUpdate; | ||
244 | ASN1_UTCTIME *nextUpdate; | ||
245 | STACK /* X509_REVOKED */ *revoked; | ||
246 | STACK /* [0] X509_EXTENSION */ *extensions; | ||
247 | } X509_CRL_INFO; | ||
248 | |||
249 | typedef struct X509_crl_st | ||
250 | { | ||
251 | /* actual signature */ | ||
252 | X509_CRL_INFO *crl; | ||
253 | X509_ALGOR *sig_alg; | ||
254 | ASN1_BIT_STRING *signature; | ||
255 | int references; | ||
256 | } X509_CRL; | ||
257 | |||
258 | /* a sequence of these are used */ | ||
259 | typedef struct x509_attributes_st | ||
260 | { | ||
261 | ASN1_OBJECT *object; | ||
262 | int set; /* 1 for a set, 0 for a single item (which is wrong) */ | ||
263 | union { | ||
264 | char *ptr; | ||
265 | /* 1 */ STACK /* ASN1_TYPE */ *set; | ||
266 | /* 0 */ ASN1_TYPE *single; | ||
267 | } value; | ||
268 | } X509_ATTRIBUTE; | ||
269 | |||
270 | typedef struct private_key_st | ||
271 | { | ||
272 | int version; | ||
273 | /* The PKCS#8 data types */ | ||
274 | X509_ALGOR *enc_algor; | ||
275 | ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ | ||
276 | |||
277 | /* When decrypted, the following will not be NULL */ | ||
278 | EVP_PKEY *dec_pkey; | ||
279 | |||
280 | /* used to encrypt and decrypt */ | ||
281 | int key_length; | ||
282 | char *key_data; | ||
283 | int key_free; /* true if we should auto free key_data */ | ||
284 | |||
285 | /* expanded version of 'enc_algor' */ | ||
286 | EVP_CIPHER_INFO cipher; | ||
287 | |||
288 | int references; | ||
289 | } X509_PKEY; | ||
290 | |||
291 | #ifdef HEADER_ENVELOPE_H | ||
292 | typedef struct X509_info_st | ||
293 | { | ||
294 | X509 *x509; | ||
295 | X509_CRL *crl; | ||
296 | X509_PKEY *x_pkey; | ||
297 | |||
298 | EVP_CIPHER_INFO enc_cipher; | ||
299 | int enc_len; | ||
300 | char *enc_data; | ||
301 | |||
302 | int references; | ||
303 | } X509_INFO; | ||
304 | #endif | ||
305 | |||
306 | /* The next 2 structures and their 8 routines were sent to me by | ||
307 | * Pat Richard <patr@x509.com> and are used to manipulate | ||
308 | * Netscapes spki strucutres - usefull if you are writing a CA web page | ||
309 | */ | ||
310 | typedef struct Netscape_spkac_st | ||
311 | { | ||
312 | X509_PUBKEY *pubkey; | ||
313 | ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */ | ||
314 | } NETSCAPE_SPKAC; | ||
315 | |||
316 | typedef struct Netscape_spki_st | ||
317 | { | ||
318 | NETSCAPE_SPKAC *spkac; /* signed public key and challenge */ | ||
319 | X509_ALGOR *sig_algor; | ||
320 | ASN1_BIT_STRING *signature; | ||
321 | } NETSCAPE_SPKI; | ||
322 | |||
323 | #ifndef HEADER_BN_H | ||
324 | #define BIGNUM char | ||
325 | #endif | ||
326 | |||
327 | typedef struct CBCParameter_st | ||
328 | { | ||
329 | unsigned char iv[8]; | ||
330 | } CBC_PARAM; | ||
331 | |||
332 | #include "x509_vfy.h" | ||
333 | #include "pkcs7.h" | ||
334 | |||
335 | #ifdef SSLEAY_MACROS | ||
336 | #define X509_verify(a,r) ASN1_verify((int (*)())i2d_X509_CINF,a->sig_alg,\ | ||
337 | a->signature,(char *)a->cert_info,r) | ||
338 | #define X509_REQ_verify(a,r) ASN1_verify((int (*)())i2d_X509_REQ_INFO, \ | ||
339 | a->sig_alg,a->signature,(char *)a->req_info,r) | ||
340 | #define X509_CRL_verify(a,r) ASN1_verify((int (*)())i2d_X509_CRL_INFO, \ | ||
341 | a->sig_alg, a->signature,(char *)a->crl,r) | ||
342 | |||
343 | #define X509_sign(x,pkey,md) \ | ||
344 | ASN1_sign((int (*)())i2d_X509_CINF, x->cert_info->signature, \ | ||
345 | x->sig_alg, x->signature, (char *)x->cert_info,pkey,md) | ||
346 | #define X509_REQ_sign(x,pkey,md) \ | ||
347 | ASN1_sign((int (*)())i2d_X509_REQ_INFO,x->sig_alg, NULL, \ | ||
348 | x->signature, (char *)x->req_info,pkey,md) | ||
349 | #define X509_CRL_sign(x,pkey,md) \ | ||
350 | ASN1_sign((int (*)())i2d_X509_CRL_INFO,x->crl->sig_alg,x->sig_alg, \ | ||
351 | x->signature, (char *)x->crl,pkey,md) | ||
352 | #define NETSCAPE_SPKI_sign(x,pkey,md) \ | ||
353 | ASN1_sign((int (*)())i2d_NETSCAPE_SPKAC, x->sig_algor,NULL, \ | ||
354 | x->signature, (char *)x->spkac,pkey,md) | ||
355 | |||
356 | #define X509_dup(x509) (X509 *)ASN1_dup((int (*)())i2d_X509, \ | ||
357 | (char *(*)())d2i_X509,(char *)x509) | ||
358 | #define X509_EXTENSION_dup(ex) (X509_EXTENSION *)ASN1_dup( \ | ||
359 | (int (*)())i2d_X509_EXTENSION, \ | ||
360 | (char *(*)())d2i_X509_EXTENSION,(char *)ex) | ||
361 | #define d2i_X509_fp(fp,x509) (X509 *)ASN1_d2i_fp((char *(*)())X509_new, \ | ||
362 | (char *(*)())d2i_X509, (fp),(unsigned char **)(x509)) | ||
363 | #define i2d_X509_fp(fp,x509) ASN1_i2d_fp(i2d_X509,fp,(unsigned char *)x509) | ||
364 | #define d2i_X509_bio(bp,x509) (X509 *)ASN1_d2i_bio((char *(*)())X509_new, \ | ||
365 | (char *(*)())d2i_X509, (bp),(unsigned char **)(x509)) | ||
366 | #define i2d_X509_bio(bp,x509) ASN1_i2d_bio(i2d_X509,bp,(unsigned char *)x509) | ||
367 | |||
368 | #define X509_CRL_dup(crl) (X509_CRL *)ASN1_dup((int (*)())i2d_X509_CRL, \ | ||
369 | (char *(*)())d2i_X509_CRL,(char *)crl) | ||
370 | #define d2i_X509_CRL_fp(fp,crl) (X509_CRL *)ASN1_d2i_fp((char *(*)()) \ | ||
371 | X509_CRL_new,(char *(*)())d2i_X509_CRL, (fp),\ | ||
372 | (unsigned char **)(crl)) | ||
373 | #define i2d_X509_CRL_fp(fp,crl) ASN1_i2d_fp(i2d_X509_CRL,fp,\ | ||
374 | (unsigned char *)crl) | ||
375 | #define d2i_X509_CRL_bio(bp,crl) (X509_CRL *)ASN1_d2i_bio((char *(*)()) \ | ||
376 | X509_CRL_new,(char *(*)())d2i_X509_CRL, (bp),\ | ||
377 | (unsigned char **)(crl)) | ||
378 | #define i2d_X509_CRL_bio(bp,crl) ASN1_i2d_bio(i2d_X509_CRL,bp,\ | ||
379 | (unsigned char *)crl) | ||
380 | |||
381 | #define PKCS7_dup(p7) (PKCS7 *)ASN1_dup((int (*)())i2d_PKCS7, \ | ||
382 | (char *(*)())d2i_PKCS7,(char *)p7) | ||
383 | #define d2i_PKCS7_fp(fp,p7) (PKCS7 *)ASN1_d2i_fp((char *(*)()) \ | ||
384 | PKCS7_new,(char *(*)())d2i_PKCS7, (fp),\ | ||
385 | (unsigned char **)(p7)) | ||
386 | #define i2d_PKCS7_fp(fp,p7) ASN1_i2d_fp(i2d_PKCS7,fp,\ | ||
387 | (unsigned char *)p7) | ||
388 | #define d2i_PKCS7_bio(bp,p7) (PKCS7 *)ASN1_d2i_bio((char *(*)()) \ | ||
389 | PKCS7_new,(char *(*)())d2i_PKCS7, (bp),\ | ||
390 | (unsigned char **)(p7)) | ||
391 | #define i2d_PKCS7_bio(bp,p7) ASN1_i2d_bio(i2d_PKCS7,bp,\ | ||
392 | (unsigned char *)p7) | ||
393 | |||
394 | #define X509_REQ_dup(req) (X509_REQ *)ASN1_dup((int (*)())i2d_X509_REQ, \ | ||
395 | (char *(*)())d2i_X509_REQ,(char *)req) | ||
396 | #define d2i_X509_REQ_fp(fp,req) (X509_REQ *)ASN1_d2i_fp((char *(*)())\ | ||
397 | X509_REQ_new, (char *(*)())d2i_X509_REQ, (fp),\ | ||
398 | (unsigned char **)(req)) | ||
399 | #define i2d_X509_REQ_fp(fp,req) ASN1_i2d_fp(i2d_X509_REQ,fp,\ | ||
400 | (unsigned char *)req) | ||
401 | #define d2i_X509_REQ_bio(bp,req) (X509_REQ *)ASN1_d2i_bio((char *(*)())\ | ||
402 | X509_REQ_new, (char *(*)())d2i_X509_REQ, (bp),\ | ||
403 | (unsigned char **)(req)) | ||
404 | #define i2d_X509_REQ_bio(bp,req) ASN1_i2d_bio(i2d_X509_REQ,bp,\ | ||
405 | (unsigned char *)req) | ||
406 | |||
407 | #define RSAPublicKey_dup(rsa) (RSA *)ASN1_dup((int (*)())i2d_RSAPublicKey, \ | ||
408 | (char *(*)())d2i_RSAPublicKey,(char *)rsa) | ||
409 | #define RSAPrivateKey_dup(rsa) (RSA *)ASN1_dup((int (*)())i2d_RSAPrivateKey, \ | ||
410 | (char *(*)())d2i_RSAPrivateKey,(char *)rsa) | ||
411 | |||
412 | #define d2i_RSAPrivateKey_fp(fp,rsa) (RSA *)ASN1_d2i_fp((char *(*)())\ | ||
413 | RSA_new,(char *(*)())d2i_RSAPrivateKey, (fp), \ | ||
414 | (unsigned char **)(rsa)) | ||
415 | #define i2d_RSAPrivateKey_fp(fp,rsa) ASN1_i2d_fp(i2d_RSAPrivateKey,fp, \ | ||
416 | (unsigned char *)rsa) | ||
417 | #define d2i_RSAPrivateKey_bio(bp,rsa) (RSA *)ASN1_d2i_bio((char *(*)())\ | ||
418 | RSA_new,(char *(*)())d2i_RSAPrivateKey, (bp), \ | ||
419 | (unsigned char **)(rsa)) | ||
420 | #define i2d_RSAPrivateKey_bio(bp,rsa) ASN1_i2d_bio(i2d_RSAPrivateKey,bp, \ | ||
421 | (unsigned char *)rsa) | ||
422 | |||
423 | #define d2i_RSAPublicKey_fp(fp,rsa) (RSA *)ASN1_d2i_fp((char *(*)())\ | ||
424 | RSA_new,(char *(*)())d2i_RSAPublicKey, (fp), \ | ||
425 | (unsigned char **)(rsa)) | ||
426 | #define i2d_RSAPublicKey_fp(fp,rsa) ASN1_i2d_fp(i2d_RSAPublicKey,fp, \ | ||
427 | (unsigned char *)rsa) | ||
428 | #define d2i_RSAPublicKey_bio(bp,rsa) (RSA *)ASN1_d2i_bio((char *(*)())\ | ||
429 | RSA_new,(char *(*)())d2i_RSAPublicKey, (bp), \ | ||
430 | (unsigned char **)(rsa)) | ||
431 | #define i2d_RSAPublicKey_bio(bp,rsa) ASN1_i2d_bio(i2d_RSAPublicKey,bp, \ | ||
432 | (unsigned char *)rsa) | ||
433 | |||
434 | #define d2i_DSAPrivateKey_fp(fp,dsa) (DSA *)ASN1_d2i_fp((char *(*)())\ | ||
435 | DSA_new,(char *(*)())d2i_DSAPrivateKey, (fp), \ | ||
436 | (unsigned char **)(dsa)) | ||
437 | #define i2d_DSAPrivateKey_fp(fp,dsa) ASN1_i2d_fp(i2d_DSAPrivateKey,fp, \ | ||
438 | (unsigned char *)dsa) | ||
439 | #define d2i_DSAPrivateKey_bio(bp,dsa) (DSA *)ASN1_d2i_bio((char *(*)())\ | ||
440 | DSA_new,(char *(*)())d2i_DSAPrivateKey, (bp), \ | ||
441 | (unsigned char **)(dsa)) | ||
442 | #define i2d_DSAPrivateKey_bio(bp,dsa) ASN1_i2d_bio(i2d_DSAPrivateKey,bp, \ | ||
443 | (unsigned char *)dsa) | ||
444 | |||
445 | #define X509_NAME_dup(xn) (X509_NAME *)ASN1_dup((int (*)())i2d_X509_NAME, \ | ||
446 | (char *(*)())d2i_X509_NAME,(char *)xn) | ||
447 | #define X509_NAME_ENTRY_dup(ne) (X509_NAME_ENTRY *)ASN1_dup( \ | ||
448 | (int (*)())i2d_X509_NAME_ENTRY, \ | ||
449 | (char *(*)())d2i_X509_NAME_ENTRY,\ | ||
450 | (char *)ne) | ||
451 | |||
452 | #define X509_digest(data,type,md,len) \ | ||
453 | ASN1_digest((int (*)())i2d_X509,type,(char *)data,md,len) | ||
454 | #define X509_NAME_digest(data,type,md,len) \ | ||
455 | ASN1_digest((int (*)())i2d_X509_NAME,type,(char *)data,md,len) | ||
456 | #define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \ | ||
457 | ASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\ | ||
458 | (char *)data,md,len) | ||
459 | #endif | ||
460 | |||
461 | #define X509_EXT_PACK_UNKNOWN 1 | ||
462 | #define X509_EXT_PACK_STRING 2 | ||
463 | |||
464 | #define X509_get_version(x) ASN1_INTEGER_get((x)->cert_info->version) | ||
465 | /* #define X509_get_serialNumber(x) ((x)->cert_info->serialNumber) */ | ||
466 | #define X509_get_notBefore(x) ((x)->cert_info->validity->notBefore) | ||
467 | #define X509_get_notAfter(x) ((x)->cert_info->validity->notAfter) | ||
468 | #define X509_extract_key(x) X509_get_pubkey(x) /*****/ | ||
469 | #define X509_REQ_get_version(x) ASN1_INTEGER_get((x)->req_info->version) | ||
470 | #define X509_REQ_get_subject_name(x) ((x)->req_info->subject) | ||
471 | #define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) | ||
472 | #define X509_name_cmp(a,b) X509_NAME_cmp((a),(b)) | ||
473 | #define X509_get_signature_type(x) EVP_PKEY_type(OBJ_obj2nid((x)->sig_alg->algorithm)) | ||
474 | |||
475 | /* This one is only used so that a binary form can output, as in | ||
476 | * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf) */ | ||
477 | #define X509_get_X509_PUBKEY(x) ((x)->cert_info->key) | ||
478 | |||
479 | #ifndef NOPROTO | ||
480 | |||
481 | #ifndef SSLEAY_MACROS | ||
482 | #ifdef HEADER_ENVELOPE_H | ||
483 | int X509_verify(X509 *a, EVP_PKEY *r); | ||
484 | char *X509_verify_cert_error_string(long n); | ||
485 | |||
486 | int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); | ||
487 | int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); | ||
488 | int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); | ||
489 | |||
490 | int X509_sign(X509 *x, EVP_PKEY *pkey, EVP_MD *md); | ||
491 | int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, EVP_MD *md); | ||
492 | int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, EVP_MD *md); | ||
493 | int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, EVP_MD *md); | ||
494 | |||
495 | int X509_digest(X509 *data,EVP_MD *type,unsigned char *md,unsigned int *len); | ||
496 | int X509_NAME_digest(X509_NAME *data,EVP_MD *type, | ||
497 | unsigned char *md,unsigned int *len); | ||
498 | #endif | ||
499 | |||
500 | #ifndef NO_FP_API | ||
501 | X509 *d2i_X509_fp(FILE *fp, X509 *x509); | ||
502 | int i2d_X509_fp(FILE *fp,X509 *x509); | ||
503 | X509_CRL *d2i_X509_CRL_fp(FILE *fp,X509_CRL *crl); | ||
504 | int i2d_X509_CRL_fp(FILE *fp,X509_CRL *crl); | ||
505 | X509_REQ *d2i_X509_REQ_fp(FILE *fp,X509_REQ *req); | ||
506 | int i2d_X509_REQ_fp(FILE *fp,X509_REQ *req); | ||
507 | RSA *d2i_RSAPrivateKey_fp(FILE *fp,RSA *rsa); | ||
508 | int i2d_RSAPrivateKey_fp(FILE *fp,RSA *rsa); | ||
509 | DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA *dsa); | ||
510 | int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); | ||
511 | RSA *d2i_RSAPublicKey_fp(FILE *fp,RSA *rsa); | ||
512 | int i2d_RSAPublicKey_fp(FILE *fp,RSA *rsa); | ||
513 | #endif | ||
514 | |||
515 | #ifdef HEADER_BIO_H | ||
516 | X509 *d2i_X509_bio(BIO *bp,X509 *x509); | ||
517 | int i2d_X509_bio(BIO *bp,X509 *x509); | ||
518 | X509_CRL *d2i_X509_CRL_bio(BIO *bp,X509_CRL *crl); | ||
519 | int i2d_X509_CRL_bio(BIO *bp,X509_CRL *crl); | ||
520 | X509_REQ *d2i_X509_REQ_bio(BIO *bp,X509_REQ *req); | ||
521 | int i2d_X509_REQ_bio(BIO *bp,X509_REQ *req); | ||
522 | RSA *d2i_RSAPrivateKey_bio(BIO *bp,RSA *rsa); | ||
523 | int i2d_RSAPrivateKey_bio(BIO *bp,RSA *rsa); | ||
524 | DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA *dsa); | ||
525 | int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa); | ||
526 | RSA *d2i_RSAPublicKey_bio(BIO *bp,RSA *rsa); | ||
527 | int i2d_RSAPublicKey_bio(BIO *bp,RSA *rsa); | ||
528 | #endif | ||
529 | |||
530 | X509 *X509_dup(X509 *x509); | ||
531 | X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex); | ||
532 | X509_CRL *X509_CRL_dup(X509_CRL *crl); | ||
533 | X509_REQ *X509_REQ_dup(X509_REQ *req); | ||
534 | X509_NAME *X509_NAME_dup(X509_NAME *xn); | ||
535 | X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne); | ||
536 | RSA *RSAPublicKey_dup(RSA *rsa); | ||
537 | RSA *RSAPrivateKey_dup(RSA *rsa); | ||
538 | |||
539 | #endif /* !SSLEAY_MACROS */ | ||
540 | |||
541 | int X509_cmp_current_time(ASN1_UTCTIME *s); | ||
542 | ASN1_UTCTIME * X509_gmtime_adj(ASN1_UTCTIME *s, long adj); | ||
543 | |||
544 | char * X509_get_default_cert_area(void ); | ||
545 | char * X509_get_default_cert_dir(void ); | ||
546 | char * X509_get_default_cert_file(void ); | ||
547 | char * X509_get_default_cert_dir_env(void ); | ||
548 | char * X509_get_default_cert_file_env(void ); | ||
549 | char * X509_get_default_private_dir(void ); | ||
550 | |||
551 | X509_REQ * X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, EVP_MD *md); | ||
552 | X509 * X509_REQ_to_X509(X509_REQ *r, int days,EVP_PKEY *pkey); | ||
553 | void ERR_load_X509_strings(void ); | ||
554 | |||
555 | X509_ALGOR * X509_ALGOR_new(void ); | ||
556 | void X509_ALGOR_free(X509_ALGOR *a); | ||
557 | int i2d_X509_ALGOR(X509_ALGOR *a,unsigned char **pp); | ||
558 | X509_ALGOR * d2i_X509_ALGOR(X509_ALGOR **a,unsigned char **pp, | ||
559 | long length); | ||
560 | |||
561 | X509_VAL * X509_VAL_new(void ); | ||
562 | void X509_VAL_free(X509_VAL *a); | ||
563 | int i2d_X509_VAL(X509_VAL *a,unsigned char **pp); | ||
564 | X509_VAL * d2i_X509_VAL(X509_VAL **a,unsigned char **pp, | ||
565 | long length); | ||
566 | |||
567 | X509_PUBKEY * X509_PUBKEY_new(void ); | ||
568 | void X509_PUBKEY_free(X509_PUBKEY *a); | ||
569 | int i2d_X509_PUBKEY(X509_PUBKEY *a,unsigned char **pp); | ||
570 | X509_PUBKEY * d2i_X509_PUBKEY(X509_PUBKEY **a,unsigned char **pp, | ||
571 | long length); | ||
572 | int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); | ||
573 | EVP_PKEY * X509_PUBKEY_get(X509_PUBKEY *key); | ||
574 | int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK *chain); | ||
575 | |||
576 | |||
577 | X509_SIG * X509_SIG_new(void ); | ||
578 | void X509_SIG_free(X509_SIG *a); | ||
579 | int i2d_X509_SIG(X509_SIG *a,unsigned char **pp); | ||
580 | X509_SIG * d2i_X509_SIG(X509_SIG **a,unsigned char **pp,long length); | ||
581 | |||
582 | X509_REQ_INFO *X509_REQ_INFO_new(void); | ||
583 | void X509_REQ_INFO_free(X509_REQ_INFO *a); | ||
584 | int i2d_X509_REQ_INFO(X509_REQ_INFO *a,unsigned char **pp); | ||
585 | X509_REQ_INFO *d2i_X509_REQ_INFO(X509_REQ_INFO **a,unsigned char **pp, | ||
586 | long length); | ||
587 | |||
588 | X509_REQ * X509_REQ_new(void); | ||
589 | void X509_REQ_free(X509_REQ *a); | ||
590 | int i2d_X509_REQ(X509_REQ *a,unsigned char **pp); | ||
591 | X509_REQ * d2i_X509_REQ(X509_REQ **a,unsigned char **pp,long length); | ||
592 | |||
593 | X509_ATTRIBUTE *X509_ATTRIBUTE_new(void ); | ||
594 | void X509_ATTRIBUTE_free(X509_ATTRIBUTE *a); | ||
595 | int i2d_X509_ATTRIBUTE(X509_ATTRIBUTE *a,unsigned char **pp); | ||
596 | X509_ATTRIBUTE *d2i_X509_ATTRIBUTE(X509_ATTRIBUTE **a,unsigned char **pp, | ||
597 | long length); | ||
598 | |||
599 | X509_EXTENSION *X509_EXTENSION_new(void ); | ||
600 | void X509_EXTENSION_free(X509_EXTENSION *a); | ||
601 | int i2d_X509_EXTENSION(X509_EXTENSION *a,unsigned char **pp); | ||
602 | X509_EXTENSION *d2i_X509_EXTENSION(X509_EXTENSION **a,unsigned char **pp, | ||
603 | long length); | ||
604 | |||
605 | X509_NAME_ENTRY *X509_NAME_ENTRY_new(void); | ||
606 | void X509_NAME_ENTRY_free(X509_NAME_ENTRY *a); | ||
607 | int i2d_X509_NAME_ENTRY(X509_NAME_ENTRY *a,unsigned char **pp); | ||
608 | X509_NAME_ENTRY *d2i_X509_NAME_ENTRY(X509_NAME_ENTRY **a,unsigned char **pp, | ||
609 | long length); | ||
610 | |||
611 | X509_NAME * X509_NAME_new(void); | ||
612 | void X509_NAME_free(X509_NAME *a); | ||
613 | int i2d_X509_NAME(X509_NAME *a,unsigned char **pp); | ||
614 | X509_NAME * d2i_X509_NAME(X509_NAME **a,unsigned char **pp,long length); | ||
615 | int X509_NAME_set(X509_NAME **xn, X509_NAME *name); | ||
616 | |||
617 | |||
618 | X509_CINF * X509_CINF_new(void); | ||
619 | void X509_CINF_free(X509_CINF *a); | ||
620 | int i2d_X509_CINF(X509_CINF *a,unsigned char **pp); | ||
621 | X509_CINF * d2i_X509_CINF(X509_CINF **a,unsigned char **pp,long length); | ||
622 | |||
623 | X509 * X509_new(void); | ||
624 | void X509_free(X509 *a); | ||
625 | int i2d_X509(X509 *a,unsigned char **pp); | ||
626 | X509 * d2i_X509(X509 **a,unsigned char **pp,long length); | ||
627 | |||
628 | X509_REVOKED * X509_REVOKED_new(void); | ||
629 | void X509_REVOKED_free(X509_REVOKED *a); | ||
630 | int i2d_X509_REVOKED(X509_REVOKED *a,unsigned char **pp); | ||
631 | X509_REVOKED * d2i_X509_REVOKED(X509_REVOKED **a,unsigned char **pp,long length); | ||
632 | |||
633 | X509_CRL_INFO *X509_CRL_INFO_new(void); | ||
634 | void X509_CRL_INFO_free(X509_CRL_INFO *a); | ||
635 | int i2d_X509_CRL_INFO(X509_CRL_INFO *a,unsigned char **pp); | ||
636 | X509_CRL_INFO *d2i_X509_CRL_INFO(X509_CRL_INFO **a,unsigned char **pp, | ||
637 | long length); | ||
638 | |||
639 | X509_CRL * X509_CRL_new(void); | ||
640 | void X509_CRL_free(X509_CRL *a); | ||
641 | int i2d_X509_CRL(X509_CRL *a,unsigned char **pp); | ||
642 | X509_CRL * d2i_X509_CRL(X509_CRL **a,unsigned char **pp,long length); | ||
643 | |||
644 | X509_PKEY * X509_PKEY_new(void ); | ||
645 | void X509_PKEY_free(X509_PKEY *a); | ||
646 | int i2d_X509_PKEY(X509_PKEY *a,unsigned char **pp); | ||
647 | X509_PKEY * d2i_X509_PKEY(X509_PKEY **a,unsigned char **pp,long length); | ||
648 | |||
649 | NETSCAPE_SPKI * NETSCAPE_SPKI_new(void ); | ||
650 | void NETSCAPE_SPKI_free(NETSCAPE_SPKI *a); | ||
651 | int i2d_NETSCAPE_SPKI(NETSCAPE_SPKI *a,unsigned char **pp); | ||
652 | NETSCAPE_SPKI * d2i_NETSCAPE_SPKI(NETSCAPE_SPKI **a,unsigned char **pp, | ||
653 | long length); | ||
654 | |||
655 | NETSCAPE_SPKAC *NETSCAPE_SPKAC_new(void ); | ||
656 | void NETSCAPE_SPKAC_free(NETSCAPE_SPKAC *a); | ||
657 | int i2d_NETSCAPE_SPKAC(NETSCAPE_SPKAC *a,unsigned char **pp); | ||
658 | NETSCAPE_SPKAC *d2i_NETSCAPE_SPKAC(NETSCAPE_SPKAC **a,unsigned char **pp, | ||
659 | long length); | ||
660 | |||
661 | #ifdef HEADER_ENVELOPE_H | ||
662 | X509_INFO * X509_INFO_new(void); | ||
663 | void X509_INFO_free(X509_INFO *a); | ||
664 | char * X509_NAME_oneline(X509_NAME *a,char *buf,int size); | ||
665 | |||
666 | int ASN1_verify(int (*i2d)(), X509_ALGOR *algor1, | ||
667 | ASN1_BIT_STRING *signature,char *data,EVP_PKEY *pkey); | ||
668 | |||
669 | int ASN1_digest(int (*i2d)(),EVP_MD *type,char *data, | ||
670 | unsigned char *md,unsigned int *len); | ||
671 | |||
672 | int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2, | ||
673 | ASN1_BIT_STRING *signature, | ||
674 | char *data,EVP_PKEY *pkey, EVP_MD *type); | ||
675 | #endif | ||
676 | |||
677 | int X509_set_version(X509 *x,long version); | ||
678 | int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial); | ||
679 | ASN1_INTEGER * X509_get_serialNumber(X509 *x); | ||
680 | int X509_set_issuer_name(X509 *x, X509_NAME *name); | ||
681 | X509_NAME * X509_get_issuer_name(X509 *a); | ||
682 | int X509_set_subject_name(X509 *x, X509_NAME *name); | ||
683 | X509_NAME * X509_get_subject_name(X509 *a); | ||
684 | int X509_set_notBefore(X509 *x, ASN1_UTCTIME *tm); | ||
685 | int X509_set_notAfter(X509 *x, ASN1_UTCTIME *tm); | ||
686 | int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); | ||
687 | EVP_PKEY * X509_get_pubkey(X509 *x); | ||
688 | int X509_certificate_type(X509 *x,EVP_PKEY *pubkey /* optional */); | ||
689 | |||
690 | int X509_REQ_set_version(X509_REQ *x,long version); | ||
691 | int X509_REQ_set_subject_name(X509_REQ *req,X509_NAME *name); | ||
692 | int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); | ||
693 | EVP_PKEY * X509_REQ_get_pubkey(X509_REQ *req); | ||
694 | |||
695 | int X509_check_private_key(X509 *x509,EVP_PKEY *pkey); | ||
696 | |||
697 | int X509_issuer_and_serial_cmp(X509 *a, X509 *b); | ||
698 | unsigned long X509_issuer_and_serial_hash(X509 *a); | ||
699 | |||
700 | int X509_issuer_name_cmp(X509 *a, X509 *b); | ||
701 | unsigned long X509_issuer_name_hash(X509 *a); | ||
702 | |||
703 | int X509_subject_name_cmp(X509 *a,X509 *b); | ||
704 | unsigned long X509_subject_name_hash(X509 *x); | ||
705 | |||
706 | int X509_NAME_cmp (X509_NAME *a, X509_NAME *b); | ||
707 | unsigned long X509_NAME_hash(X509_NAME *x); | ||
708 | |||
709 | int X509_CRL_cmp(X509_CRL *a,X509_CRL *b); | ||
710 | #ifndef NO_FP_API | ||
711 | int X509_print_fp(FILE *bp,X509 *x); | ||
712 | int X509_REQ_print_fp(FILE *bp,X509_REQ *req); | ||
713 | #endif | ||
714 | |||
715 | #ifdef HEADER_BIO_H | ||
716 | int X509_NAME_print(BIO *bp, X509_NAME *name, int obase); | ||
717 | int X509_print(BIO *bp,X509 *x); | ||
718 | int X509_REQ_print(BIO *bp,X509_REQ *req); | ||
719 | #endif | ||
720 | |||
721 | int X509_NAME_entry_count(X509_NAME *name); | ||
722 | int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, | ||
723 | char *buf,int len); | ||
724 | int X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, | ||
725 | char *buf,int len); | ||
726 | |||
727 | /* NOTE: you should be passsing -1, not 0 as lastpos. The functions that use | ||
728 | * lastpos, seach after that position on. */ | ||
729 | int X509_NAME_get_index_by_NID(X509_NAME *name,int nid,int lastpos); | ||
730 | int X509_NAME_get_index_by_OBJ(X509_NAME *name,ASN1_OBJECT *obj, | ||
731 | int lastpos); | ||
732 | X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc); | ||
733 | X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); | ||
734 | int X509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne, | ||
735 | int loc, int set); | ||
736 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, | ||
737 | int type,unsigned char *bytes, int len); | ||
738 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, | ||
739 | ASN1_OBJECT *obj, int type,unsigned char *bytes, | ||
740 | int len); | ||
741 | int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, | ||
742 | ASN1_OBJECT *obj); | ||
743 | int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, | ||
744 | unsigned char *bytes, int len); | ||
745 | ASN1_OBJECT * X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne); | ||
746 | ASN1_STRING * X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne); | ||
747 | |||
748 | int X509v3_get_ext_count(STACK *x); | ||
749 | int X509v3_get_ext_by_NID(STACK *x, int nid, int lastpos); | ||
750 | int X509v3_get_ext_by_OBJ(STACK *x,ASN1_OBJECT *obj,int lastpos); | ||
751 | int X509v3_get_ext_by_critical(STACK *x, int crit, int lastpos); | ||
752 | X509_EXTENSION *X509v3_get_ext(STACK *x, int loc); | ||
753 | X509_EXTENSION *X509v3_delete_ext(STACK *x, int loc); | ||
754 | STACK * X509v3_add_ext(STACK **x, X509_EXTENSION *ex, int loc); | ||
755 | |||
756 | int X509v3_data_type_by_OBJ(ASN1_OBJECT *obj); | ||
757 | int X509v3_data_type_by_NID(int nid); | ||
758 | int X509v3_pack_type_by_OBJ(ASN1_OBJECT *obj); | ||
759 | int X509v3_pack_type_by_NID(int nid); | ||
760 | |||
761 | int X509_get_ext_count(X509 *x); | ||
762 | int X509_get_ext_by_NID(X509 *x, int nid, int lastpos); | ||
763 | int X509_get_ext_by_OBJ(X509 *x,ASN1_OBJECT *obj,int lastpos); | ||
764 | int X509_get_ext_by_critical(X509 *x, int crit, int lastpos); | ||
765 | X509_EXTENSION *X509_get_ext(X509 *x, int loc); | ||
766 | X509_EXTENSION *X509_delete_ext(X509 *x, int loc); | ||
767 | int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc); | ||
768 | |||
769 | int X509_CRL_get_ext_count(X509_CRL *x); | ||
770 | int X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos); | ||
771 | int X509_CRL_get_ext_by_OBJ(X509_CRL *x,ASN1_OBJECT *obj,int lastpos); | ||
772 | int X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos); | ||
773 | X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc); | ||
774 | X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); | ||
775 | int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc); | ||
776 | |||
777 | int X509_REVOKED_get_ext_count(X509_REVOKED *x); | ||
778 | int X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos); | ||
779 | int X509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x,ASN1_OBJECT *obj,int lastpos); | ||
780 | int X509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int lastpos); | ||
781 | X509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc); | ||
782 | X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); | ||
783 | int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc); | ||
784 | |||
785 | X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, | ||
786 | int nid, int crit, ASN1_OCTET_STRING *data); | ||
787 | X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, | ||
788 | ASN1_OBJECT *obj,int crit,ASN1_OCTET_STRING *data); | ||
789 | int X509_EXTENSION_set_object(X509_EXTENSION *ex,ASN1_OBJECT *obj); | ||
790 | int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit); | ||
791 | int X509_EXTENSION_set_data(X509_EXTENSION *ex, | ||
792 | ASN1_OCTET_STRING *data); | ||
793 | ASN1_OBJECT * X509_EXTENSION_get_object(X509_EXTENSION *ex); | ||
794 | ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); | ||
795 | int X509_EXTENSION_get_critical(X509_EXTENSION *ex); | ||
796 | ASN1_OCTET_STRING *X509v3_pack_string(ASN1_OCTET_STRING **ex,int type, | ||
797 | unsigned char *bytes, int len); | ||
798 | ASN1_STRING * X509v3_unpack_string(ASN1_STRING **ex,int type, | ||
799 | ASN1_OCTET_STRING *os); | ||
800 | |||
801 | int X509_verify_cert(X509_STORE_CTX *ctx); | ||
802 | |||
803 | /* lookup a cert from a X509 STACK */ | ||
804 | X509 *X509_find_by_issuer_and_serial(STACK *sk,X509_NAME *name, | ||
805 | ASN1_INTEGER *serial); | ||
806 | X509 *X509_find_by_subject(STACK *sk,X509_NAME *name); | ||
807 | |||
808 | #else | ||
809 | |||
810 | #ifndef SSLEAY_MACROS | ||
811 | #ifdef HEADER_ENVELOPE_H | ||
812 | int X509_verify(); | ||
813 | int X509_REQ_verify(); | ||
814 | int X509_CRL_verify(); | ||
815 | int NETSCAPE_SPKI_verify(); | ||
816 | |||
817 | int X509_sign(); | ||
818 | int X509_REQ_sign(); | ||
819 | int X509_CRL_sign(); | ||
820 | int NETSCAPE_SPKI_sign(); | ||
821 | |||
822 | int X509_digest(); | ||
823 | int X509_NAME_digest(); | ||
824 | #endif | ||
825 | |||
826 | #ifndef NO_FP_API | ||
827 | X509 *d2i_X509_fp(); | ||
828 | int i2d_X509_fp(); | ||
829 | X509_CRL *d2i_X509_CRL_fp(); | ||
830 | int i2d_X509_CRL_fp(); | ||
831 | X509_REQ *d2i_X509_REQ_fp(); | ||
832 | int i2d_X509_REQ_fp(); | ||
833 | RSA *d2i_RSAPrivateKey_fp(); | ||
834 | int i2d_RSAPrivateKey_fp(); | ||
835 | DSA *d2i_DSAPrivateKey_fp(); | ||
836 | int i2d_DSAPrivateKey_fp(); | ||
837 | RSA *d2i_RSAPublicKey_fp(); | ||
838 | int i2d_RSAPublicKey_fp(); | ||
839 | #endif | ||
840 | |||
841 | X509 *d2i_X509_bio(); | ||
842 | int i2d_X509_bio(); | ||
843 | X509_CRL *d2i_X509_CRL_bio(); | ||
844 | int i2d_X509_CRL_bio(); | ||
845 | X509_REQ *d2i_X509_REQ_bio(); | ||
846 | int i2d_X509_REQ_bio(); | ||
847 | RSA *d2i_RSAPrivateKey_bio(); | ||
848 | int i2d_RSAPrivateKey_bio(); | ||
849 | DSA *d2i_DSAPrivateKey_bio(); | ||
850 | int i2d_DSAPrivateKey_bio(); | ||
851 | RSA *d2i_RSAPublicKey_bio(); | ||
852 | int i2d_RSAPublicKey_bio(); | ||
853 | |||
854 | X509 *X509_dup(); | ||
855 | X509_EXTENSION *X509_EXTENSION_dup(); | ||
856 | X509_CRL *X509_CRL_dup(); | ||
857 | X509_REQ *X509_REQ_dup(); | ||
858 | X509_NAME *X509_NAME_dup(); | ||
859 | X509_NAME_ENTRY *X509_NAME_ENTRY_dup(); | ||
860 | RSA *RSAPublicKey_dup(); | ||
861 | RSA *RSAPrivateKey_dup(); | ||
862 | |||
863 | #endif /* !SSLEAY_MACROS */ | ||
864 | |||
865 | int X509_cmp_current_time(); | ||
866 | ASN1_UTCTIME * X509_gmtime_adj(); | ||
867 | |||
868 | char * X509_get_default_cert_area(); | ||
869 | char * X509_get_default_cert_dir(); | ||
870 | char * X509_get_default_cert_file(); | ||
871 | char * X509_get_default_cert_dir_env(); | ||
872 | char * X509_get_default_cert_file_env(); | ||
873 | char * X509_get_default_private_dir(); | ||
874 | |||
875 | X509_REQ * X509_to_X509_REQ(); | ||
876 | X509 * X509_REQ_to_X509(); | ||
877 | void ERR_load_X509_strings(); | ||
878 | |||
879 | X509_ALGOR * X509_ALGOR_new(); | ||
880 | void X509_ALGOR_free(); | ||
881 | int i2d_X509_ALGOR(); | ||
882 | X509_ALGOR * d2i_X509_ALGOR(); | ||
883 | |||
884 | X509_VAL * X509_VAL_new(); | ||
885 | void X509_VAL_free(); | ||
886 | int i2d_X509_VAL(); | ||
887 | X509_VAL * d2i_X509_VAL(); | ||
888 | |||
889 | X509_PUBKEY * X509_PUBKEY_new(); | ||
890 | void X509_PUBKEY_free(); | ||
891 | int i2d_X509_PUBKEY(); | ||
892 | X509_PUBKEY * d2i_X509_PUBKEY(); | ||
893 | int X509_PUBKEY_set(); | ||
894 | EVP_PKEY * X509_PUBKEY_get(); | ||
895 | int X509_get_pubkey_parameters(); | ||
896 | |||
897 | X509_SIG * X509_SIG_new(); | ||
898 | void X509_SIG_free(); | ||
899 | int i2d_X509_SIG(); | ||
900 | X509_SIG * d2i_X509_SIG(); | ||
901 | |||
902 | X509_REQ_INFO *X509_REQ_INFO_new(); | ||
903 | void X509_REQ_INFO_free(); | ||
904 | int i2d_X509_REQ_INFO(); | ||
905 | X509_REQ_INFO *d2i_X509_REQ_INFO(); | ||
906 | |||
907 | X509_REQ * X509_REQ_new(); | ||
908 | void X509_REQ_free(); | ||
909 | int i2d_X509_REQ(); | ||
910 | X509_REQ * d2i_X509_REQ(); | ||
911 | |||
912 | X509_ATTRIBUTE *X509_ATTRIBUTE_new(); | ||
913 | void X509_ATTRIBUTE_free(); | ||
914 | int i2d_X509_ATTRIBUTE(); | ||
915 | X509_ATTRIBUTE *d2i_X509_ATTRIBUTE(); | ||
916 | |||
917 | X509_EXTENSION *X509_EXTENSION_new(); | ||
918 | void X509_EXTENSION_free(); | ||
919 | int i2d_X509_EXTENSION(); | ||
920 | X509_EXTENSION *d2i_X509_EXTENSION(); | ||
921 | |||
922 | X509_NAME_ENTRY *X509_NAME_ENTRY_new(); | ||
923 | void X509_NAME_ENTRY_free(); | ||
924 | int i2d_X509_NAME_ENTRY(); | ||
925 | X509_NAME_ENTRY *d2i_X509_NAME_ENTRY(); | ||
926 | |||
927 | X509_NAME * X509_NAME_new(); | ||
928 | void X509_NAME_free(); | ||
929 | int i2d_X509_NAME(); | ||
930 | X509_NAME * d2i_X509_NAME(); | ||
931 | int X509_NAME_set(); | ||
932 | |||
933 | |||
934 | X509_CINF * X509_CINF_new(); | ||
935 | void X509_CINF_free(); | ||
936 | int i2d_X509_CINF(); | ||
937 | X509_CINF * d2i_X509_CINF(); | ||
938 | |||
939 | X509 * X509_new(); | ||
940 | void X509_free(); | ||
941 | int i2d_X509(); | ||
942 | X509 * d2i_X509(); | ||
943 | |||
944 | X509_REVOKED * X509_REVOKED_new(); | ||
945 | void X509_REVOKED_free(); | ||
946 | int i2d_X509_REVOKED(); | ||
947 | X509_REVOKED * d2i_X509_REVOKED(); | ||
948 | |||
949 | X509_CRL_INFO *X509_CRL_INFO_new(); | ||
950 | void X509_CRL_INFO_free(); | ||
951 | int i2d_X509_CRL_INFO(); | ||
952 | X509_CRL_INFO *d2i_X509_CRL_INFO(); | ||
953 | |||
954 | X509_CRL * X509_CRL_new(); | ||
955 | void X509_CRL_free(); | ||
956 | int i2d_X509_CRL(); | ||
957 | X509_CRL * d2i_X509_CRL(); | ||
958 | |||
959 | X509_PKEY * X509_PKEY_new(); | ||
960 | void X509_PKEY_free(); | ||
961 | int i2d_X509_PKEY(); | ||
962 | X509_PKEY * d2i_X509_PKEY(); | ||
963 | |||
964 | NETSCAPE_SPKI * NETSCAPE_SPKI_new(); | ||
965 | void NETSCAPE_SPKI_free(); | ||
966 | int i2d_NETSCAPE_SPKI(); | ||
967 | NETSCAPE_SPKI * d2i_NETSCAPE_SPKI(); | ||
968 | |||
969 | NETSCAPE_SPKAC *NETSCAPE_SPKAC_new(); | ||
970 | void NETSCAPE_SPKAC_free(); | ||
971 | int i2d_NETSCAPE_SPKAC(); | ||
972 | NETSCAPE_SPKAC *d2i_NETSCAPE_SPKAC(); | ||
973 | |||
974 | #ifdef HEADER_ENVELOPE_H | ||
975 | X509_INFO * X509_INFO_new(); | ||
976 | void X509_INFO_free(); | ||
977 | #endif | ||
978 | |||
979 | char * X509_NAME_oneline(); | ||
980 | |||
981 | int ASN1_verify(); | ||
982 | int ASN1_digest(); | ||
983 | int ASN1_sign(); | ||
984 | |||
985 | int X509_set_version(); | ||
986 | int X509_set_serialNumber(); | ||
987 | ASN1_INTEGER * X509_get_serialNumber(); | ||
988 | int X509_set_issuer_name(); | ||
989 | X509_NAME * X509_get_issuer_name(); | ||
990 | int X509_set_subject_name(); | ||
991 | X509_NAME * X509_get_subject_name(); | ||
992 | int X509_set_notBefore(); | ||
993 | int X509_set_notAfter(); | ||
994 | int X509_set_pubkey(); | ||
995 | EVP_PKEY * X509_get_pubkey(); | ||
996 | int X509_certificate_type(); | ||
997 | |||
998 | int X509_REQ_set_version(); | ||
999 | int X509_REQ_set_subject_name(); | ||
1000 | int X509_REQ_set_pubkey(); | ||
1001 | EVP_PKEY * X509_REQ_get_pubkey(); | ||
1002 | |||
1003 | int X509_check_private_key(); | ||
1004 | |||
1005 | int X509_issuer_and_serial_cmp(); | ||
1006 | unsigned long X509_issuer_and_serial_hash(); | ||
1007 | |||
1008 | int X509_issuer_name_cmp(); | ||
1009 | unsigned long X509_issuer_name_hash(); | ||
1010 | |||
1011 | int X509_subject_name_cmp(); | ||
1012 | unsigned long X509_subject_name_hash(); | ||
1013 | |||
1014 | int X509_NAME_cmp (); | ||
1015 | unsigned long X509_NAME_hash(); | ||
1016 | |||
1017 | int X509_CRL_cmp(); | ||
1018 | #ifndef NO_FP_API | ||
1019 | int X509_print_fp(); | ||
1020 | int X509_REQ_print_fp(); | ||
1021 | #endif | ||
1022 | |||
1023 | int X509_NAME_print(); | ||
1024 | int X509_print(); | ||
1025 | int X509_REQ_print(); | ||
1026 | |||
1027 | int X509_NAME_entry_count(); | ||
1028 | int X509_NAME_get_text_by_NID(); | ||
1029 | int X509_NAME_get_text_by_OBJ(); | ||
1030 | |||
1031 | int X509_NAME_get_index_by_NID(); | ||
1032 | int X509_NAME_get_index_by_OBJ(); | ||
1033 | X509_NAME_ENTRY *X509_NAME_get_entry(); | ||
1034 | X509_NAME_ENTRY *X509_NAME_delete_entry(); | ||
1035 | int X509_NAME_add_entry(); | ||
1036 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(); | ||
1037 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(); | ||
1038 | int X509_NAME_ENTRY_set_object(); | ||
1039 | int X509_NAME_ENTRY_set_data(); | ||
1040 | ASN1_OBJECT * X509_NAME_ENTRY_get_object(); | ||
1041 | ASN1_STRING * X509_NAME_ENTRY_get_data(); | ||
1042 | |||
1043 | int X509v3_get_ext_count(); | ||
1044 | int X509v3_get_ext_by_NID(); | ||
1045 | int X509v3_get_ext_by_OBJ(); | ||
1046 | int X509v3_get_ext_by_critical(); | ||
1047 | X509_EXTENSION *X509v3_get_ext(); | ||
1048 | X509_EXTENSION *X509v3_delete_ext(); | ||
1049 | STACK * X509v3_add_ext(); | ||
1050 | |||
1051 | int X509v3_data_type_by_OBJ(); | ||
1052 | int X509v3_data_type_by_NID(); | ||
1053 | int X509v3_pack_type_by_OBJ(); | ||
1054 | int X509v3_pack_type_by_NID(); | ||
1055 | |||
1056 | int X509_get_ext_count(); | ||
1057 | int X509_get_ext_by_NID(); | ||
1058 | int X509_get_ext_by_OBJ(); | ||
1059 | int X509_get_ext_by_critical(); | ||
1060 | X509_EXTENSION *X509_get_ext(); | ||
1061 | X509_EXTENSION *X509_delete_ext(); | ||
1062 | int X509_add_ext(); | ||
1063 | |||
1064 | int X509_CRL_get_ext_count(); | ||
1065 | int X509_CRL_get_ext_by_NID(); | ||
1066 | int X509_CRL_get_ext_by_OBJ(); | ||
1067 | int X509_CRL_get_ext_by_critical(); | ||
1068 | X509_EXTENSION *X509_CRL_get_ext(); | ||
1069 | X509_EXTENSION *X509_CRL_delete_ext(); | ||
1070 | int X509_CRL_add_ext(); | ||
1071 | |||
1072 | int X509_REVOKED_get_ext_count(); | ||
1073 | int X509_REVOKED_get_ext_by_NID(); | ||
1074 | int X509_REVOKED_get_ext_by_OBJ(); | ||
1075 | int X509_REVOKED_get_ext_by_critical(); | ||
1076 | X509_EXTENSION *X509_REVOKED_get_ext(); | ||
1077 | X509_EXTENSION *X509_REVOKED_delete_ext(); | ||
1078 | int X509_REVOKED_add_ext(); | ||
1079 | |||
1080 | X509_EXTENSION *X509_EXTENSION_create_by_NID(); | ||
1081 | X509_EXTENSION *X509_EXTENSION_create_by_OBJ(); | ||
1082 | int X509_EXTENSION_set_object(); | ||
1083 | int X509_EXTENSION_set_critical(); | ||
1084 | int X509_EXTENSION_set_data(); | ||
1085 | ASN1_OBJECT * X509_EXTENSION_get_object(); | ||
1086 | ASN1_OCTET_STRING *X509_EXTENSION_get_data(); | ||
1087 | int X509_EXTENSION_get_critical(); | ||
1088 | ASN1_OCTET_STRING *X509v3_pack_string(); | ||
1089 | ASN1_STRING * X509v3_unpack_string(); | ||
1090 | |||
1091 | int X509_verify_cert(); | ||
1092 | char * X509_verify_cert_error_string(); | ||
1093 | |||
1094 | /* lookup a cert from a X509 STACK */ | ||
1095 | X509 *X509_find_by_issuer_and_serial(); | ||
1096 | X509 *X509_find_by_subject(); | ||
1097 | |||
1098 | #endif | ||
1099 | |||
1100 | /* BEGIN ERROR CODES */ | ||
1101 | /* Error codes for the X509 functions. */ | ||
1102 | |||
1103 | /* Function codes. */ | ||
1104 | #define X509_F_ADD_CERT_DIR 100 | ||
1105 | #define X509_F_BY_FILE_CTRL 101 | ||
1106 | #define X509_F_DIR_CTRL 102 | ||
1107 | #define X509_F_GET_CERT_BY_SUBJECT 103 | ||
1108 | #define X509_F_X509V3_ADD_EXT 104 | ||
1109 | #define X509_F_X509V3_ADD_EXTENSION 105 | ||
1110 | #define X509_F_X509V3_PACK_STRING 106 | ||
1111 | #define X509_F_X509V3_UNPACK_STRING 107 | ||
1112 | #define X509_F_X509_EXTENSION_CREATE_BY_NID 108 | ||
1113 | #define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 | ||
1114 | #define X509_F_X509_GET_PUBKEY_PARAMETERS 110 | ||
1115 | #define X509_F_X509_LOAD_CERT_FILE 111 | ||
1116 | #define X509_F_X509_LOAD_CRL_FILE 112 | ||
1117 | #define X509_F_X509_NAME_ADD_ENTRY 113 | ||
1118 | #define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 | ||
1119 | #define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 | ||
1120 | #define X509_F_X509_NAME_ONELINE 116 | ||
1121 | #define X509_F_X509_NAME_PRINT 117 | ||
1122 | #define X509_F_X509_PRINT_FP 118 | ||
1123 | #define X509_F_X509_PUBKEY_GET 119 | ||
1124 | #define X509_F_X509_PUBKEY_SET 120 | ||
1125 | #define X509_F_X509_REQ_PRINT 121 | ||
1126 | #define X509_F_X509_REQ_PRINT_FP 122 | ||
1127 | #define X509_F_X509_REQ_TO_X509 123 | ||
1128 | #define X509_F_X509_STORE_ADD_CERT 124 | ||
1129 | #define X509_F_X509_STORE_ADD_CRL 125 | ||
1130 | #define X509_F_X509_TO_X509_REQ 126 | ||
1131 | #define X509_F_X509_VERIFY_CERT 127 | ||
1132 | |||
1133 | /* Reason codes. */ | ||
1134 | #define X509_R_BAD_X509_FILETYPE 100 | ||
1135 | #define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 | ||
1136 | #define X509_R_ERR_ASN1_LIB 102 | ||
1137 | #define X509_R_LOADING_CERT_DIR 103 | ||
1138 | #define X509_R_LOADING_DEFAULTS 104 | ||
1139 | #define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 | ||
1140 | #define X509_R_SHOULD_RETRY 106 | ||
1141 | #define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 | ||
1142 | #define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 | ||
1143 | #define X509_R_UNKNOWN_NID 109 | ||
1144 | #define X509_R_UNKNOWN_STRING_TYPE 110 | ||
1145 | #define X509_R_UNSUPPORTED_ALGORITHM 111 | ||
1146 | #define X509_R_WRONG_LOOKUP_TYPE 112 | ||
1147 | |||
1148 | #ifdef __cplusplus | ||
1149 | } | ||
1150 | #endif | ||
1151 | #endif | ||
1152 | |||