diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib/libcrypto/x509/x509.h | 1041 |
1 files changed, 0 insertions, 1041 deletions
diff --git a/src/lib/libcrypto/x509/x509.h b/src/lib/libcrypto/x509/x509.h deleted file mode 100644 index a198b23202..0000000000 --- a/src/lib/libcrypto/x509/x509.h +++ /dev/null | |||
@@ -1,1041 +0,0 @@ | |||
1 | /* $OpenBSD: x509.h,v 1.121 2025/03/09 15:17:22 tb Exp $ */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | /* ==================================================================== | ||
59 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | ||
60 | * ECDH support in OpenSSL originally developed by | ||
61 | * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. | ||
62 | */ | ||
63 | |||
64 | #ifndef HEADER_X509_H | ||
65 | #define HEADER_X509_H | ||
66 | |||
67 | #include <openssl/opensslconf.h> | ||
68 | |||
69 | #include <openssl/asn1.h> | ||
70 | #ifndef OPENSSL_NO_BIO | ||
71 | #include <openssl/bio.h> | ||
72 | #endif | ||
73 | #ifndef OPENSSL_NO_BUFFER | ||
74 | #include <openssl/buffer.h> | ||
75 | #endif | ||
76 | #ifndef OPENSSL_NO_DH | ||
77 | #include <openssl/dh.h> | ||
78 | #endif | ||
79 | #ifndef OPENSSL_NO_DSA | ||
80 | #include <openssl/dsa.h> | ||
81 | #endif | ||
82 | #ifndef OPENSSL_NO_EC | ||
83 | #include <openssl/ec.h> | ||
84 | #endif | ||
85 | #ifndef OPENSSL_NO_EVP | ||
86 | #include <openssl/evp.h> | ||
87 | #endif | ||
88 | #ifndef OPENSSL_NO_RSA | ||
89 | #include <openssl/rsa.h> | ||
90 | #endif | ||
91 | #ifndef OPENSSL_NO_SHA | ||
92 | #include <openssl/sha.h> | ||
93 | #endif | ||
94 | #include <openssl/stack.h> | ||
95 | #include <openssl/safestack.h> | ||
96 | |||
97 | #include <openssl/ossl_typ.h> | ||
98 | |||
99 | #ifdef __cplusplus | ||
100 | extern "C" { | ||
101 | #endif | ||
102 | |||
103 | #define X509_FILETYPE_PEM 1 | ||
104 | #define X509_FILETYPE_ASN1 2 | ||
105 | #define X509_FILETYPE_DEFAULT 3 | ||
106 | |||
107 | #define X509v3_KU_DIGITAL_SIGNATURE 0x0080 | ||
108 | #define X509v3_KU_NON_REPUDIATION 0x0040 | ||
109 | #define X509v3_KU_KEY_ENCIPHERMENT 0x0020 | ||
110 | #define X509v3_KU_DATA_ENCIPHERMENT 0x0010 | ||
111 | #define X509v3_KU_KEY_AGREEMENT 0x0008 | ||
112 | #define X509v3_KU_KEY_CERT_SIGN 0x0004 | ||
113 | #define X509v3_KU_CRL_SIGN 0x0002 | ||
114 | #define X509v3_KU_ENCIPHER_ONLY 0x0001 | ||
115 | #define X509v3_KU_DECIPHER_ONLY 0x8000 | ||
116 | #define X509v3_KU_UNDEF 0xffff | ||
117 | |||
118 | struct X509_algor_st { | ||
119 | ASN1_OBJECT *algorithm; | ||
120 | ASN1_TYPE *parameter; | ||
121 | } /* X509_ALGOR */; | ||
122 | |||
123 | typedef STACK_OF(X509_ALGOR) X509_ALGORS; | ||
124 | |||
125 | typedef struct X509_val_st X509_VAL; | ||
126 | |||
127 | typedef struct X509_sig_st X509_SIG; | ||
128 | |||
129 | typedef struct X509_name_entry_st X509_NAME_ENTRY; | ||
130 | |||
131 | DECLARE_STACK_OF(X509_NAME_ENTRY) | ||
132 | |||
133 | DECLARE_STACK_OF(X509_NAME) | ||
134 | |||
135 | typedef struct X509_extension_st X509_EXTENSION; | ||
136 | |||
137 | typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS; | ||
138 | |||
139 | DECLARE_STACK_OF(X509_EXTENSION) | ||
140 | |||
141 | typedef struct x509_attributes_st X509_ATTRIBUTE; | ||
142 | |||
143 | DECLARE_STACK_OF(X509_ATTRIBUTE) | ||
144 | |||
145 | typedef struct X509_req_info_st X509_REQ_INFO; | ||
146 | |||
147 | typedef struct X509_req_st X509_REQ; | ||
148 | |||
149 | typedef struct x509_cinf_st X509_CINF; | ||
150 | |||
151 | DECLARE_STACK_OF(X509) | ||
152 | |||
153 | #define X509_TRUST_COMPAT 1 | ||
154 | #define X509_TRUST_SSL_CLIENT 2 | ||
155 | #define X509_TRUST_SSL_SERVER 3 | ||
156 | #define X509_TRUST_EMAIL 4 | ||
157 | #define X509_TRUST_OBJECT_SIGN 5 | ||
158 | #define X509_TRUST_OCSP_SIGN 6 | ||
159 | #define X509_TRUST_OCSP_REQUEST 7 | ||
160 | #define X509_TRUST_TSA 8 | ||
161 | |||
162 | /* Keep these up to date! */ | ||
163 | #define X509_TRUST_MIN 1 | ||
164 | #define X509_TRUST_MAX 8 | ||
165 | |||
166 | /* Flags for X509_print_ex() */ | ||
167 | |||
168 | #define X509_FLAG_COMPAT 0 | ||
169 | #define X509_FLAG_NO_HEADER 1L | ||
170 | #define X509_FLAG_NO_VERSION (1L << 1) | ||
171 | #define X509_FLAG_NO_SERIAL (1L << 2) | ||
172 | #define X509_FLAG_NO_SIGNAME (1L << 3) | ||
173 | #define X509_FLAG_NO_ISSUER (1L << 4) | ||
174 | #define X509_FLAG_NO_VALIDITY (1L << 5) | ||
175 | #define X509_FLAG_NO_SUBJECT (1L << 6) | ||
176 | #define X509_FLAG_NO_PUBKEY (1L << 7) | ||
177 | #define X509_FLAG_NO_EXTENSIONS (1L << 8) | ||
178 | #define X509_FLAG_NO_SIGDUMP (1L << 9) | ||
179 | #define X509_FLAG_NO_AUX (1L << 10) | ||
180 | #define X509_FLAG_NO_ATTRIBUTES (1L << 11) | ||
181 | |||
182 | /* Flags specific to X509_NAME_print_ex() */ | ||
183 | |||
184 | /* The field separator information */ | ||
185 | |||
186 | #define XN_FLAG_SEP_MASK (0xf << 16) | ||
187 | |||
188 | #define XN_FLAG_COMPAT 0 /* Traditional SSLeay: use old X509_NAME_print */ | ||
189 | #define XN_FLAG_SEP_COMMA_PLUS (1 << 16) /* RFC2253 ,+ */ | ||
190 | #define XN_FLAG_SEP_CPLUS_SPC (2 << 16) /* ,+ spaced: more readable */ | ||
191 | #define XN_FLAG_SEP_SPLUS_SPC (3 << 16) /* ;+ spaced */ | ||
192 | #define XN_FLAG_SEP_MULTILINE (4 << 16) /* One line per field */ | ||
193 | |||
194 | #define XN_FLAG_DN_REV (1 << 20) /* Reverse DN order */ | ||
195 | |||
196 | /* How the field name is shown */ | ||
197 | |||
198 | #define XN_FLAG_FN_MASK (0x3 << 21) | ||
199 | |||
200 | #define XN_FLAG_FN_SN 0 /* Object short name */ | ||
201 | #define XN_FLAG_FN_LN (1 << 21) /* Object long name */ | ||
202 | #define XN_FLAG_FN_OID (2 << 21) /* Always use OIDs */ | ||
203 | #define XN_FLAG_FN_NONE (3 << 21) /* No field names */ | ||
204 | |||
205 | #define XN_FLAG_SPC_EQ (1 << 23) /* Put spaces round '=' */ | ||
206 | |||
207 | /* This determines if we dump fields we don't recognise: | ||
208 | * RFC2253 requires this. | ||
209 | */ | ||
210 | |||
211 | #define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24) | ||
212 | |||
213 | #define XN_FLAG_FN_ALIGN (1 << 25) /* Align field names to 20 characters */ | ||
214 | |||
215 | /* Complete set of RFC2253 flags */ | ||
216 | |||
217 | #define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \ | ||
218 | XN_FLAG_SEP_COMMA_PLUS | \ | ||
219 | XN_FLAG_DN_REV | \ | ||
220 | XN_FLAG_FN_SN | \ | ||
221 | XN_FLAG_DUMP_UNKNOWN_FIELDS) | ||
222 | |||
223 | /* readable oneline form */ | ||
224 | |||
225 | #define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \ | ||
226 | ASN1_STRFLGS_ESC_QUOTE | \ | ||
227 | XN_FLAG_SEP_CPLUS_SPC | \ | ||
228 | XN_FLAG_SPC_EQ | \ | ||
229 | XN_FLAG_FN_SN) | ||
230 | |||
231 | /* readable multiline form */ | ||
232 | |||
233 | #define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \ | ||
234 | ASN1_STRFLGS_ESC_MSB | \ | ||
235 | XN_FLAG_SEP_MULTILINE | \ | ||
236 | XN_FLAG_SPC_EQ | \ | ||
237 | XN_FLAG_FN_LN | \ | ||
238 | XN_FLAG_FN_ALIGN) | ||
239 | |||
240 | DECLARE_STACK_OF(X509_REVOKED) | ||
241 | |||
242 | typedef struct X509_crl_info_st X509_CRL_INFO; | ||
243 | |||
244 | DECLARE_STACK_OF(X509_CRL) | ||
245 | |||
246 | typedef struct private_key_st { | ||
247 | int version; | ||
248 | /* The PKCS#8 data types */ | ||
249 | X509_ALGOR *enc_algor; | ||
250 | ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ | ||
251 | |||
252 | /* When decrypted, the following will not be NULL */ | ||
253 | EVP_PKEY *dec_pkey; | ||
254 | |||
255 | /* used to encrypt and decrypt */ | ||
256 | int key_length; | ||
257 | char *key_data; | ||
258 | int key_free; /* true if we should auto free key_data */ | ||
259 | |||
260 | /* expanded version of 'enc_algor' */ | ||
261 | EVP_CIPHER_INFO cipher; | ||
262 | |||
263 | int references; | ||
264 | } X509_PKEY; | ||
265 | |||
266 | #ifndef OPENSSL_NO_EVP | ||
267 | typedef struct X509_info_st { | ||
268 | X509 *x509; | ||
269 | X509_CRL *crl; | ||
270 | X509_PKEY *x_pkey; | ||
271 | |||
272 | EVP_CIPHER_INFO enc_cipher; | ||
273 | int enc_len; | ||
274 | char *enc_data; | ||
275 | |||
276 | int references; | ||
277 | } X509_INFO; | ||
278 | |||
279 | DECLARE_STACK_OF(X509_INFO) | ||
280 | #endif | ||
281 | |||
282 | /* The next 2 structures and their 8 routines were sent to me by | ||
283 | * Pat Richard <patr@x509.com> and are used to manipulate | ||
284 | * Netscapes spki structures - useful if you are writing a CA web page | ||
285 | */ | ||
286 | typedef struct Netscape_spkac_st { | ||
287 | X509_PUBKEY *pubkey; | ||
288 | ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */ | ||
289 | } NETSCAPE_SPKAC; | ||
290 | |||
291 | typedef struct Netscape_spki_st { | ||
292 | NETSCAPE_SPKAC *spkac; /* signed public key and challenge */ | ||
293 | X509_ALGOR *sig_algor; | ||
294 | ASN1_BIT_STRING *signature; | ||
295 | } NETSCAPE_SPKI; | ||
296 | |||
297 | typedef struct PBEPARAM_st { | ||
298 | ASN1_OCTET_STRING *salt; | ||
299 | ASN1_INTEGER *iter; | ||
300 | } PBEPARAM; | ||
301 | |||
302 | #ifdef __cplusplus | ||
303 | } | ||
304 | #endif | ||
305 | |||
306 | #include <openssl/x509_vfy.h> | ||
307 | #include <openssl/pkcs7.h> | ||
308 | |||
309 | #ifdef __cplusplus | ||
310 | extern "C" { | ||
311 | #endif | ||
312 | |||
313 | #define X509_extract_key(x) X509_get_pubkey(x) /*****/ | ||
314 | #define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) | ||
315 | #define X509_name_cmp(a,b) X509_NAME_cmp((a),(b)) | ||
316 | |||
317 | int X509_CRL_up_ref(X509_CRL *x); | ||
318 | int X509_CRL_get_signature_nid(const X509_CRL *crl); | ||
319 | |||
320 | int i2d_re_X509_CRL_tbs(X509_CRL *req, unsigned char **pp); | ||
321 | |||
322 | const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl); | ||
323 | long X509_CRL_get_version(const X509_CRL *crl); | ||
324 | const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl); | ||
325 | const ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl); | ||
326 | ASN1_TIME *X509_CRL_get_lastUpdate(X509_CRL *crl); | ||
327 | ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *crl); | ||
328 | X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl); | ||
329 | STACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl); | ||
330 | void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig, | ||
331 | const X509_ALGOR **palg); | ||
332 | |||
333 | const X509_ALGOR *X509_CRL_get0_tbs_sigalg(const X509_CRL *crl); | ||
334 | |||
335 | int X509_REQ_get_signature_nid(const X509_REQ *req); | ||
336 | |||
337 | void X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig, | ||
338 | const X509_ALGOR **palg); | ||
339 | |||
340 | X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x); | ||
341 | |||
342 | const char *X509_verify_cert_error_string(long n); | ||
343 | |||
344 | #ifndef OPENSSL_NO_EVP | ||
345 | int X509_verify(X509 *a, EVP_PKEY *r); | ||
346 | |||
347 | int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); | ||
348 | int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); | ||
349 | int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); | ||
350 | |||
351 | NETSCAPE_SPKI * NETSCAPE_SPKI_b64_decode(const char *str, int len); | ||
352 | char * NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x); | ||
353 | EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x); | ||
354 | int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey); | ||
355 | |||
356 | int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki); | ||
357 | |||
358 | int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent); | ||
359 | int X509_signature_print(BIO *bp, const X509_ALGOR *alg, | ||
360 | const ASN1_STRING *sig); | ||
361 | |||
362 | int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); | ||
363 | int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx); | ||
364 | int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); | ||
365 | int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx); | ||
366 | int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); | ||
367 | int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx); | ||
368 | int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); | ||
369 | |||
370 | int X509_pubkey_digest(const X509 *data,const EVP_MD *type, | ||
371 | unsigned char *md, unsigned int *len); | ||
372 | int X509_digest(const X509 *data,const EVP_MD *type, | ||
373 | unsigned char *md, unsigned int *len); | ||
374 | int X509_CRL_digest(const X509_CRL *data,const EVP_MD *type, | ||
375 | unsigned char *md, unsigned int *len); | ||
376 | int X509_REQ_digest(const X509_REQ *data,const EVP_MD *type, | ||
377 | unsigned char *md, unsigned int *len); | ||
378 | int X509_NAME_digest(const X509_NAME *data,const EVP_MD *type, | ||
379 | unsigned char *md, unsigned int *len); | ||
380 | #endif | ||
381 | |||
382 | X509 *d2i_X509_fp(FILE *fp, X509 **x509); | ||
383 | int i2d_X509_fp(FILE *fp,X509 *x509); | ||
384 | X509_CRL *d2i_X509_CRL_fp(FILE *fp,X509_CRL **crl); | ||
385 | int i2d_X509_CRL_fp(FILE *fp,X509_CRL *crl); | ||
386 | X509_REQ *d2i_X509_REQ_fp(FILE *fp,X509_REQ **req); | ||
387 | int i2d_X509_REQ_fp(FILE *fp,X509_REQ *req); | ||
388 | #ifndef OPENSSL_NO_RSA | ||
389 | RSA *d2i_RSAPrivateKey_fp(FILE *fp,RSA **rsa); | ||
390 | int i2d_RSAPrivateKey_fp(FILE *fp,RSA *rsa); | ||
391 | RSA *d2i_RSAPublicKey_fp(FILE *fp,RSA **rsa); | ||
392 | int i2d_RSAPublicKey_fp(FILE *fp,RSA *rsa); | ||
393 | RSA *d2i_RSA_PUBKEY_fp(FILE *fp,RSA **rsa); | ||
394 | int i2d_RSA_PUBKEY_fp(FILE *fp,RSA *rsa); | ||
395 | #endif | ||
396 | #ifndef OPENSSL_NO_DSA | ||
397 | DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); | ||
398 | int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa); | ||
399 | DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); | ||
400 | int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); | ||
401 | #endif | ||
402 | #ifndef OPENSSL_NO_EC | ||
403 | EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey); | ||
404 | int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey); | ||
405 | EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey); | ||
406 | int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey); | ||
407 | #endif | ||
408 | X509_SIG *d2i_PKCS8_fp(FILE *fp,X509_SIG **p8); | ||
409 | int i2d_PKCS8_fp(FILE *fp,X509_SIG *p8); | ||
410 | PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, | ||
411 | PKCS8_PRIV_KEY_INFO **p8inf); | ||
412 | int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,PKCS8_PRIV_KEY_INFO *p8inf); | ||
413 | int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); | ||
414 | int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); | ||
415 | EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); | ||
416 | int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey); | ||
417 | EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a); | ||
418 | |||
419 | #ifndef OPENSSL_NO_BIO | ||
420 | X509 *d2i_X509_bio(BIO *bp,X509 **x509); | ||
421 | int i2d_X509_bio(BIO *bp,X509 *x509); | ||
422 | X509_CRL *d2i_X509_CRL_bio(BIO *bp,X509_CRL **crl); | ||
423 | int i2d_X509_CRL_bio(BIO *bp,X509_CRL *crl); | ||
424 | X509_REQ *d2i_X509_REQ_bio(BIO *bp,X509_REQ **req); | ||
425 | int i2d_X509_REQ_bio(BIO *bp,X509_REQ *req); | ||
426 | #ifndef OPENSSL_NO_RSA | ||
427 | RSA *d2i_RSAPrivateKey_bio(BIO *bp,RSA **rsa); | ||
428 | int i2d_RSAPrivateKey_bio(BIO *bp,RSA *rsa); | ||
429 | RSA *d2i_RSAPublicKey_bio(BIO *bp,RSA **rsa); | ||
430 | int i2d_RSAPublicKey_bio(BIO *bp,RSA *rsa); | ||
431 | RSA *d2i_RSA_PUBKEY_bio(BIO *bp,RSA **rsa); | ||
432 | int i2d_RSA_PUBKEY_bio(BIO *bp,RSA *rsa); | ||
433 | #endif | ||
434 | #ifndef OPENSSL_NO_DSA | ||
435 | DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); | ||
436 | int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa); | ||
437 | DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa); | ||
438 | int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa); | ||
439 | #endif | ||
440 | #ifndef OPENSSL_NO_EC | ||
441 | EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey); | ||
442 | int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey); | ||
443 | EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey); | ||
444 | int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey); | ||
445 | #endif | ||
446 | X509_SIG *d2i_PKCS8_bio(BIO *bp,X509_SIG **p8); | ||
447 | int i2d_PKCS8_bio(BIO *bp,X509_SIG *p8); | ||
448 | PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, | ||
449 | PKCS8_PRIV_KEY_INFO **p8inf); | ||
450 | int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,PKCS8_PRIV_KEY_INFO *p8inf); | ||
451 | int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); | ||
452 | int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); | ||
453 | EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); | ||
454 | int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey); | ||
455 | EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a); | ||
456 | #endif | ||
457 | |||
458 | X509 *X509_dup(X509 *x509); | ||
459 | X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa); | ||
460 | X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex); | ||
461 | X509_CRL *X509_CRL_dup(X509_CRL *crl); | ||
462 | X509_REQ *X509_REQ_dup(X509_REQ *req); | ||
463 | X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn); | ||
464 | int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval); | ||
465 | void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, const void **ppval, | ||
466 | const X509_ALGOR *algor); | ||
467 | int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b); | ||
468 | |||
469 | X509_NAME *X509_NAME_dup(X509_NAME *xn); | ||
470 | int X509_NAME_get0_der(X509_NAME *nm, const unsigned char **pder, size_t *pderlen); | ||
471 | X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne); | ||
472 | |||
473 | int X509_cmp_time(const ASN1_TIME *s, time_t *t); | ||
474 | int X509_cmp_current_time(const ASN1_TIME *s); | ||
475 | ASN1_TIME * X509_time_adj(ASN1_TIME *s, long adj, time_t *t); | ||
476 | ASN1_TIME * X509_time_adj_ex(ASN1_TIME *s, | ||
477 | int offset_day, long offset_sec, time_t *t); | ||
478 | ASN1_TIME * X509_gmtime_adj(ASN1_TIME *s, long adj); | ||
479 | |||
480 | const char * X509_get_default_cert_area(void ); | ||
481 | const char * X509_get_default_cert_dir(void ); | ||
482 | const char * X509_get_default_cert_file(void ); | ||
483 | const char * X509_get_default_cert_dir_env(void ); | ||
484 | const char * X509_get_default_cert_file_env(void ); | ||
485 | const char * X509_get_default_private_dir(void ); | ||
486 | |||
487 | X509_REQ * X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); | ||
488 | X509 * X509_REQ_to_X509(X509_REQ *r, int days,EVP_PKEY *pkey); | ||
489 | |||
490 | X509_ALGOR *X509_ALGOR_new(void); | ||
491 | void X509_ALGOR_free(X509_ALGOR *a); | ||
492 | X509_ALGOR *d2i_X509_ALGOR(X509_ALGOR **a, const unsigned char **in, long len); | ||
493 | int i2d_X509_ALGOR(X509_ALGOR *a, unsigned char **out); | ||
494 | extern const ASN1_ITEM X509_ALGOR_it; | ||
495 | X509_ALGORS *d2i_X509_ALGORS(X509_ALGORS **a, const unsigned char **in, long len); | ||
496 | int i2d_X509_ALGORS(X509_ALGORS *a, unsigned char **out); | ||
497 | extern const ASN1_ITEM X509_ALGORS_it; | ||
498 | X509_VAL *X509_VAL_new(void); | ||
499 | void X509_VAL_free(X509_VAL *a); | ||
500 | X509_VAL *d2i_X509_VAL(X509_VAL **a, const unsigned char **in, long len); | ||
501 | int i2d_X509_VAL(X509_VAL *a, unsigned char **out); | ||
502 | extern const ASN1_ITEM X509_VAL_it; | ||
503 | |||
504 | X509_PUBKEY *X509_PUBKEY_new(void); | ||
505 | void X509_PUBKEY_free(X509_PUBKEY *a); | ||
506 | X509_PUBKEY *d2i_X509_PUBKEY(X509_PUBKEY **a, const unsigned char **in, long len); | ||
507 | int i2d_X509_PUBKEY(X509_PUBKEY *a, unsigned char **out); | ||
508 | extern const ASN1_ITEM X509_PUBKEY_it; | ||
509 | |||
510 | int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); | ||
511 | EVP_PKEY * X509_PUBKEY_get(X509_PUBKEY *key); | ||
512 | EVP_PKEY * X509_PUBKEY_get0(X509_PUBKEY *key); | ||
513 | int X509_get_pubkey_parameters(EVP_PKEY *pkey, | ||
514 | STACK_OF(X509) *chain); | ||
515 | int i2d_PUBKEY(EVP_PKEY *a,unsigned char **pp); | ||
516 | EVP_PKEY * d2i_PUBKEY(EVP_PKEY **a,const unsigned char **pp, | ||
517 | long length); | ||
518 | #ifndef OPENSSL_NO_RSA | ||
519 | int i2d_RSA_PUBKEY(RSA *a,unsigned char **pp); | ||
520 | RSA * d2i_RSA_PUBKEY(RSA **a,const unsigned char **pp, | ||
521 | long length); | ||
522 | #endif | ||
523 | #ifndef OPENSSL_NO_DSA | ||
524 | int i2d_DSA_PUBKEY(DSA *a,unsigned char **pp); | ||
525 | DSA * d2i_DSA_PUBKEY(DSA **a,const unsigned char **pp, | ||
526 | long length); | ||
527 | #endif | ||
528 | #ifndef OPENSSL_NO_EC | ||
529 | int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp); | ||
530 | EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, | ||
531 | long length); | ||
532 | #endif | ||
533 | |||
534 | X509_SIG *X509_SIG_new(void); | ||
535 | void X509_SIG_free(X509_SIG *a); | ||
536 | X509_SIG *d2i_X509_SIG(X509_SIG **a, const unsigned char **in, long len); | ||
537 | int i2d_X509_SIG(X509_SIG *a, unsigned char **out); | ||
538 | extern const ASN1_ITEM X509_SIG_it; | ||
539 | void X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **palg, | ||
540 | const ASN1_OCTET_STRING **pdigest); | ||
541 | void X509_SIG_getm(X509_SIG *sig, X509_ALGOR **palg, | ||
542 | ASN1_OCTET_STRING **pdigest); | ||
543 | |||
544 | X509_REQ_INFO *X509_REQ_INFO_new(void); | ||
545 | void X509_REQ_INFO_free(X509_REQ_INFO *a); | ||
546 | X509_REQ_INFO *d2i_X509_REQ_INFO(X509_REQ_INFO **a, const unsigned char **in, long len); | ||
547 | int i2d_X509_REQ_INFO(X509_REQ_INFO *a, unsigned char **out); | ||
548 | extern const ASN1_ITEM X509_REQ_INFO_it; | ||
549 | X509_REQ *X509_REQ_new(void); | ||
550 | void X509_REQ_free(X509_REQ *a); | ||
551 | X509_REQ *d2i_X509_REQ(X509_REQ **a, const unsigned char **in, long len); | ||
552 | int i2d_X509_REQ(X509_REQ *a, unsigned char **out); | ||
553 | extern const ASN1_ITEM X509_REQ_it; | ||
554 | |||
555 | X509_ATTRIBUTE *X509_ATTRIBUTE_new(void); | ||
556 | void X509_ATTRIBUTE_free(X509_ATTRIBUTE *a); | ||
557 | X509_ATTRIBUTE *d2i_X509_ATTRIBUTE(X509_ATTRIBUTE **a, const unsigned char **in, long len); | ||
558 | int i2d_X509_ATTRIBUTE(X509_ATTRIBUTE *a, unsigned char **out); | ||
559 | extern const ASN1_ITEM X509_ATTRIBUTE_it; | ||
560 | X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value); | ||
561 | |||
562 | X509_EXTENSION *X509_EXTENSION_new(void); | ||
563 | void X509_EXTENSION_free(X509_EXTENSION *a); | ||
564 | X509_EXTENSION *d2i_X509_EXTENSION(X509_EXTENSION **a, const unsigned char **in, long len); | ||
565 | int i2d_X509_EXTENSION(X509_EXTENSION *a, unsigned char **out); | ||
566 | extern const ASN1_ITEM X509_EXTENSION_it; | ||
567 | X509_EXTENSIONS *d2i_X509_EXTENSIONS(X509_EXTENSIONS **a, const unsigned char **in, long len); | ||
568 | int i2d_X509_EXTENSIONS(X509_EXTENSIONS *a, unsigned char **out); | ||
569 | extern const ASN1_ITEM X509_EXTENSIONS_it; | ||
570 | |||
571 | X509_NAME_ENTRY *X509_NAME_ENTRY_new(void); | ||
572 | void X509_NAME_ENTRY_free(X509_NAME_ENTRY *a); | ||
573 | X509_NAME_ENTRY *d2i_X509_NAME_ENTRY(X509_NAME_ENTRY **a, const unsigned char **in, long len); | ||
574 | int i2d_X509_NAME_ENTRY(X509_NAME_ENTRY *a, unsigned char **out); | ||
575 | extern const ASN1_ITEM X509_NAME_ENTRY_it; | ||
576 | |||
577 | X509_NAME *X509_NAME_new(void); | ||
578 | void X509_NAME_free(X509_NAME *a); | ||
579 | X509_NAME *d2i_X509_NAME(X509_NAME **a, const unsigned char **in, long len); | ||
580 | int i2d_X509_NAME(X509_NAME *a, unsigned char **out); | ||
581 | extern const ASN1_ITEM X509_NAME_it; | ||
582 | |||
583 | int X509_NAME_set(X509_NAME **xn, X509_NAME *name); | ||
584 | |||
585 | X509_CINF *X509_CINF_new(void); | ||
586 | void X509_CINF_free(X509_CINF *a); | ||
587 | X509_CINF *d2i_X509_CINF(X509_CINF **a, const unsigned char **in, long len); | ||
588 | int i2d_X509_CINF(X509_CINF *a, unsigned char **out); | ||
589 | extern const ASN1_ITEM X509_CINF_it; | ||
590 | |||
591 | X509 *X509_new(void); | ||
592 | void X509_free(X509 *a); | ||
593 | X509 *d2i_X509(X509 **a, const unsigned char **in, long len); | ||
594 | int i2d_X509(X509 *a, unsigned char **out); | ||
595 | extern const ASN1_ITEM X509_it; | ||
596 | |||
597 | int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | ||
598 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); | ||
599 | int X509_set_ex_data(X509 *r, int idx, void *arg); | ||
600 | void *X509_get_ex_data(X509 *r, int idx); | ||
601 | int i2d_X509_AUX(X509 *a,unsigned char **pp); | ||
602 | X509 * d2i_X509_AUX(X509 **a,const unsigned char **pp,long length); | ||
603 | |||
604 | int i2d_re_X509_tbs(X509 *x, unsigned char **pp); | ||
605 | |||
606 | /* Flags returned by X509_get_signature_info(): valid and suitable for TLS. */ | ||
607 | #define X509_SIG_INFO_VALID 1 | ||
608 | #define X509_SIG_INFO_TLS 2 | ||
609 | int X509_get_signature_info(X509 *x, int *mdnid, int *pknid, int *secbits, | ||
610 | uint32_t *flags); | ||
611 | |||
612 | void X509_get0_signature(const ASN1_BIT_STRING **psig, | ||
613 | const X509_ALGOR **palg, const X509 *x); | ||
614 | int X509_get_signature_nid(const X509 *x); | ||
615 | |||
616 | int X509_alias_set1(X509 *x, const unsigned char *name, int len); | ||
617 | int X509_keyid_set1(X509 *x, const unsigned char *id, int len); | ||
618 | unsigned char *X509_alias_get0(X509 *x, int *len); | ||
619 | unsigned char *X509_keyid_get0(X509 *x, int *len); | ||
620 | int X509_add1_trust_object(X509 *x, const ASN1_OBJECT *obj); | ||
621 | int X509_add1_reject_object(X509 *x, const ASN1_OBJECT *obj); | ||
622 | void X509_trust_clear(X509 *x); | ||
623 | void X509_reject_clear(X509 *x); | ||
624 | |||
625 | X509_REVOKED *X509_REVOKED_new(void); | ||
626 | void X509_REVOKED_free(X509_REVOKED *a); | ||
627 | X509_REVOKED *X509_REVOKED_dup(X509_REVOKED *a); | ||
628 | X509_REVOKED *d2i_X509_REVOKED(X509_REVOKED **a, const unsigned char **in, long len); | ||
629 | int i2d_X509_REVOKED(X509_REVOKED *a, unsigned char **out); | ||
630 | extern const ASN1_ITEM X509_REVOKED_it; | ||
631 | |||
632 | X509_CRL_INFO *X509_CRL_INFO_new(void); | ||
633 | void X509_CRL_INFO_free(X509_CRL_INFO *a); | ||
634 | X509_CRL_INFO *d2i_X509_CRL_INFO(X509_CRL_INFO **a, const unsigned char **in, long len); | ||
635 | int i2d_X509_CRL_INFO(X509_CRL_INFO *a, unsigned char **out); | ||
636 | extern const ASN1_ITEM X509_CRL_INFO_it; | ||
637 | |||
638 | X509_CRL *X509_CRL_new(void); | ||
639 | void X509_CRL_free(X509_CRL *a); | ||
640 | X509_CRL *d2i_X509_CRL(X509_CRL **a, const unsigned char **in, long len); | ||
641 | int i2d_X509_CRL(X509_CRL *a, unsigned char **out); | ||
642 | extern const ASN1_ITEM X509_CRL_it; | ||
643 | |||
644 | int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); | ||
645 | int X509_CRL_get0_by_serial(X509_CRL *crl, | ||
646 | X509_REVOKED **ret, ASN1_INTEGER *serial); | ||
647 | int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x); | ||
648 | |||
649 | X509_PKEY * X509_PKEY_new(void ); | ||
650 | void X509_PKEY_free(X509_PKEY *a); | ||
651 | |||
652 | NETSCAPE_SPKI *NETSCAPE_SPKI_new(void); | ||
653 | void NETSCAPE_SPKI_free(NETSCAPE_SPKI *a); | ||
654 | NETSCAPE_SPKI *d2i_NETSCAPE_SPKI(NETSCAPE_SPKI **a, const unsigned char **in, long len); | ||
655 | int i2d_NETSCAPE_SPKI(NETSCAPE_SPKI *a, unsigned char **out); | ||
656 | extern const ASN1_ITEM NETSCAPE_SPKI_it; | ||
657 | NETSCAPE_SPKAC *NETSCAPE_SPKAC_new(void); | ||
658 | void NETSCAPE_SPKAC_free(NETSCAPE_SPKAC *a); | ||
659 | NETSCAPE_SPKAC *d2i_NETSCAPE_SPKAC(NETSCAPE_SPKAC **a, const unsigned char **in, long len); | ||
660 | int i2d_NETSCAPE_SPKAC(NETSCAPE_SPKAC *a, unsigned char **out); | ||
661 | extern const ASN1_ITEM NETSCAPE_SPKAC_it; | ||
662 | |||
663 | #ifndef OPENSSL_NO_EVP | ||
664 | X509_INFO * X509_INFO_new(void); | ||
665 | void X509_INFO_free(X509_INFO *a); | ||
666 | char * X509_NAME_oneline(const X509_NAME *a, char *buf, int size); | ||
667 | |||
668 | int ASN1_item_digest(const ASN1_ITEM *it,const EVP_MD *type,void *data, | ||
669 | unsigned char *md,unsigned int *len); | ||
670 | |||
671 | int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1, | ||
672 | ASN1_BIT_STRING *signature,void *data,EVP_PKEY *pkey); | ||
673 | |||
674 | int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, | ||
675 | ASN1_BIT_STRING *signature, | ||
676 | void *data, EVP_PKEY *pkey, const EVP_MD *type); | ||
677 | int ASN1_item_sign_ctx(const ASN1_ITEM *it, | ||
678 | X509_ALGOR *algor1, X509_ALGOR *algor2, | ||
679 | ASN1_BIT_STRING *signature, void *asn, EVP_MD_CTX *ctx); | ||
680 | #endif | ||
681 | |||
682 | const STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x); | ||
683 | void X509_get0_uids(const X509 *x, const ASN1_BIT_STRING **issuerUID, | ||
684 | const ASN1_BIT_STRING **subjectUID); | ||
685 | const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x); | ||
686 | int X509_set_version(X509 *x, long version); | ||
687 | long X509_get_version(const X509 *x); | ||
688 | int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial); | ||
689 | ASN1_INTEGER * X509_get_serialNumber(X509 *x); | ||
690 | const ASN1_INTEGER *X509_get0_serialNumber(const X509 *x); | ||
691 | int X509_set_issuer_name(X509 *x, X509_NAME *name); | ||
692 | X509_NAME * X509_get_issuer_name(const X509 *a); | ||
693 | int X509_set_subject_name(X509 *x, X509_NAME *name); | ||
694 | X509_NAME * X509_get_subject_name(const X509 *a); | ||
695 | int X509_set_notBefore(X509 *x, const ASN1_TIME *tm); | ||
696 | int X509_set1_notBefore(X509 *x, const ASN1_TIME *tm); | ||
697 | int X509_set_notAfter(X509 *x, const ASN1_TIME *tm); | ||
698 | int X509_set1_notAfter(X509 *x, const ASN1_TIME *tm); | ||
699 | const ASN1_TIME *X509_get0_notBefore(const X509 *x); | ||
700 | ASN1_TIME *X509_getm_notBefore(const X509 *x); | ||
701 | const ASN1_TIME *X509_get0_notAfter(const X509 *x); | ||
702 | ASN1_TIME *X509_getm_notAfter(const X509 *x); | ||
703 | int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); | ||
704 | EVP_PKEY * X509_get_pubkey(X509 *x); | ||
705 | EVP_PKEY * X509_get0_pubkey(const X509 *x); | ||
706 | ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x); | ||
707 | int X509_certificate_type(const X509 *x, const EVP_PKEY *pubkey); | ||
708 | int X509_get_signature_type(const X509 *x); | ||
709 | |||
710 | #define X509_get_notBefore X509_getm_notBefore | ||
711 | #define X509_get_notAfter X509_getm_notAfter | ||
712 | |||
713 | int X509_REQ_set_version(X509_REQ *x,long version); | ||
714 | long X509_REQ_get_version(const X509_REQ *x); | ||
715 | int X509_REQ_set_subject_name(X509_REQ *req, X509_NAME *name); | ||
716 | X509_NAME *X509_REQ_get_subject_name(const X509_REQ *x); | ||
717 | int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); | ||
718 | EVP_PKEY * X509_REQ_get_pubkey(X509_REQ *req); | ||
719 | int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp); | ||
720 | EVP_PKEY * X509_REQ_get0_pubkey(X509_REQ *req); | ||
721 | int X509_REQ_extension_nid(int nid); | ||
722 | STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req); | ||
723 | int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, | ||
724 | int nid); | ||
725 | int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts); | ||
726 | int X509_REQ_get_attr_count(const X509_REQ *req); | ||
727 | int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, | ||
728 | int lastpos); | ||
729 | int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, const ASN1_OBJECT *obj, | ||
730 | int lastpos); | ||
731 | X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc); | ||
732 | X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc); | ||
733 | int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr); | ||
734 | int X509_REQ_add1_attr_by_OBJ(X509_REQ *req, | ||
735 | const ASN1_OBJECT *obj, int type, | ||
736 | const unsigned char *bytes, int len); | ||
737 | int X509_REQ_add1_attr_by_NID(X509_REQ *req, | ||
738 | int nid, int type, | ||
739 | const unsigned char *bytes, int len); | ||
740 | int X509_REQ_add1_attr_by_txt(X509_REQ *req, | ||
741 | const char *attrname, int type, | ||
742 | const unsigned char *bytes, int len); | ||
743 | |||
744 | int X509_CRL_set_version(X509_CRL *x, long version); | ||
745 | int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name); | ||
746 | int X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm); | ||
747 | int X509_CRL_set1_lastUpdate(X509_CRL *x, const ASN1_TIME *tm); | ||
748 | int X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm); | ||
749 | int X509_CRL_set1_nextUpdate(X509_CRL *x, const ASN1_TIME *tm); | ||
750 | int X509_CRL_sort(X509_CRL *crl); | ||
751 | |||
752 | const STACK_OF(X509_EXTENSION) *X509_REVOKED_get0_extensions(const X509_REVOKED *x); | ||
753 | const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *x); | ||
754 | const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x); | ||
755 | int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); | ||
756 | int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); | ||
757 | |||
758 | int X509_REQ_check_private_key(X509_REQ *x509,EVP_PKEY *pkey); | ||
759 | |||
760 | int X509_check_private_key(const X509 *x509, const EVP_PKEY *pkey); | ||
761 | |||
762 | int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b); | ||
763 | unsigned long X509_issuer_and_serial_hash(X509 *a); | ||
764 | |||
765 | int X509_issuer_name_cmp(const X509 *a, const X509 *b); | ||
766 | unsigned long X509_issuer_name_hash(X509 *a); | ||
767 | |||
768 | int X509_subject_name_cmp(const X509 *a, const X509 *b); | ||
769 | unsigned long X509_subject_name_hash(X509 *x); | ||
770 | |||
771 | #ifndef OPENSSL_NO_MD5 | ||
772 | unsigned long X509_issuer_name_hash_old(X509 *a); | ||
773 | unsigned long X509_subject_name_hash_old(X509 *x); | ||
774 | #endif | ||
775 | |||
776 | int X509_cmp(const X509 *a, const X509 *b); | ||
777 | int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b); | ||
778 | unsigned long X509_NAME_hash(X509_NAME *x); | ||
779 | unsigned long X509_NAME_hash_old(X509_NAME *x); | ||
780 | |||
781 | int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); | ||
782 | int X509_CRL_match(const X509_CRL *a, const X509_CRL *b); | ||
783 | int X509_print_ex_fp(FILE *bp,X509 *x, unsigned long nmflag, unsigned long cflag); | ||
784 | int X509_print_fp(FILE *bp,X509 *x); | ||
785 | int X509_CRL_print_fp(FILE *bp,X509_CRL *x); | ||
786 | int X509_REQ_print_fp(FILE *bp,X509_REQ *req); | ||
787 | int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent, | ||
788 | unsigned long flags); | ||
789 | |||
790 | #ifndef OPENSSL_NO_BIO | ||
791 | int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent, | ||
792 | unsigned long flags); | ||
793 | int X509_print_ex(BIO *bp,X509 *x, unsigned long nmflag, unsigned long cflag); | ||
794 | int X509_print(BIO *bp,X509 *x); | ||
795 | int X509_ocspid_print(BIO *bp,X509 *x); | ||
796 | int X509_CRL_print(BIO *bp,X509_CRL *x); | ||
797 | int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, unsigned long cflag); | ||
798 | int X509_REQ_print(BIO *bp,X509_REQ *req); | ||
799 | #endif | ||
800 | |||
801 | int X509_NAME_entry_count(const X509_NAME *name); | ||
802 | int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, | ||
803 | char *buf,int len); | ||
804 | int X509_NAME_get_text_by_OBJ(X509_NAME *name, | ||
805 | const ASN1_OBJECT *obj, char *buf,int len); | ||
806 | |||
807 | /* NOTE: you should be passing -1, not 0 as lastpos. The functions that use | ||
808 | * lastpos, search after that position on. */ | ||
809 | int X509_NAME_get_index_by_NID(const X509_NAME *name, int nid, | ||
810 | int lastpos); | ||
811 | int X509_NAME_get_index_by_OBJ(const X509_NAME *name, | ||
812 | const ASN1_OBJECT *obj, int lastpos); | ||
813 | X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc); | ||
814 | X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); | ||
815 | int X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne, | ||
816 | int loc, int set); | ||
817 | int X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, | ||
818 | int type, const unsigned char *bytes, int len, int loc, int set); | ||
819 | int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, | ||
820 | const unsigned char *bytes, int len, int loc, int set); | ||
821 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, | ||
822 | const char *field, int type, const unsigned char *bytes, int len); | ||
823 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, | ||
824 | int type, const unsigned char *bytes, int len); | ||
825 | int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, | ||
826 | const unsigned char *bytes, int len, int loc, int set); | ||
827 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, | ||
828 | const ASN1_OBJECT *obj, int type, | ||
829 | const unsigned char *bytes, int len); | ||
830 | int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, | ||
831 | const ASN1_OBJECT *obj); | ||
832 | int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, | ||
833 | const unsigned char *bytes, int len); | ||
834 | ASN1_OBJECT * X509_NAME_ENTRY_get_object(const X509_NAME_ENTRY *ne); | ||
835 | ASN1_STRING * X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne); | ||
836 | int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne); | ||
837 | |||
838 | int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x); | ||
839 | int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, | ||
840 | int nid, int lastpos); | ||
841 | int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x, | ||
842 | const ASN1_OBJECT *obj, int lastpos); | ||
843 | int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x, | ||
844 | int crit, int lastpos); | ||
845 | X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc); | ||
846 | X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc); | ||
847 | STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, | ||
848 | X509_EXTENSION *ex, int loc); | ||
849 | |||
850 | int X509_get_ext_count(const X509 *x); | ||
851 | int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos); | ||
852 | int X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, | ||
853 | int lastpos); | ||
854 | int X509_get_ext_by_critical(const X509 *x, int crit, int lastpos); | ||
855 | X509_EXTENSION *X509_get_ext(const X509 *x, int loc); | ||
856 | X509_EXTENSION *X509_delete_ext(X509 *x, int loc); | ||
857 | int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc); | ||
858 | void * X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx); | ||
859 | int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit, | ||
860 | unsigned long flags); | ||
861 | |||
862 | int X509_CRL_get_ext_count(const X509_CRL *x); | ||
863 | int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, | ||
864 | int lastpos); | ||
865 | int X509_CRL_get_ext_by_OBJ(const X509_CRL *x, | ||
866 | const ASN1_OBJECT *obj, int lastpos); | ||
867 | int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, | ||
868 | int lastpos); | ||
869 | X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc); | ||
870 | X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); | ||
871 | int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc); | ||
872 | void * X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, | ||
873 | int *idx); | ||
874 | int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, | ||
875 | int crit, unsigned long flags); | ||
876 | |||
877 | int X509_REVOKED_get_ext_count(const X509_REVOKED *x); | ||
878 | int X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, | ||
879 | int lastpos); | ||
880 | int X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, | ||
881 | const ASN1_OBJECT *obj, int lastpos); | ||
882 | int X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, | ||
883 | int crit, int lastpos); | ||
884 | X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc); | ||
885 | X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); | ||
886 | int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, | ||
887 | int loc); | ||
888 | void * X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid, | ||
889 | int *crit, int *idx); | ||
890 | int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, | ||
891 | int crit, unsigned long flags); | ||
892 | |||
893 | X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, | ||
894 | int nid, int crit, ASN1_OCTET_STRING *data); | ||
895 | X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, | ||
896 | const ASN1_OBJECT *obj, int crit, ASN1_OCTET_STRING *data); | ||
897 | int X509_EXTENSION_set_object(X509_EXTENSION *ex, | ||
898 | const ASN1_OBJECT *obj); | ||
899 | int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit); | ||
900 | int X509_EXTENSION_set_data(X509_EXTENSION *ex, | ||
901 | ASN1_OCTET_STRING *data); | ||
902 | ASN1_OBJECT * X509_EXTENSION_get_object(X509_EXTENSION *ex); | ||
903 | ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); | ||
904 | int X509_EXTENSION_get_critical(const X509_EXTENSION *ex); | ||
905 | |||
906 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, | ||
907 | int atrtype, const void *data, int len); | ||
908 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, | ||
909 | const ASN1_OBJECT *obj, int atrtype, const void *data, int len); | ||
910 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, | ||
911 | const char *atrname, int type, const unsigned char *bytes, int len); | ||
912 | int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj); | ||
913 | int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data, int len); | ||
914 | void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, | ||
915 | int atrtype, void *data); | ||
916 | int X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr); | ||
917 | ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr); | ||
918 | ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx); | ||
919 | |||
920 | int X509_verify_cert(X509_STORE_CTX *ctx); | ||
921 | |||
922 | /* lookup a cert from a X509 STACK */ | ||
923 | X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk,X509_NAME *name, | ||
924 | ASN1_INTEGER *serial); | ||
925 | X509 *X509_find_by_subject(STACK_OF(X509) *sk,X509_NAME *name); | ||
926 | |||
927 | extern const ASN1_ITEM PBEPARAM_it; | ||
928 | |||
929 | /* PKCS#8 utilities */ | ||
930 | |||
931 | PKCS8_PRIV_KEY_INFO *PKCS8_PRIV_KEY_INFO_new(void); | ||
932 | void PKCS8_PRIV_KEY_INFO_free(PKCS8_PRIV_KEY_INFO *a); | ||
933 | PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO **a, const unsigned char **in, long len); | ||
934 | int i2d_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO *a, unsigned char **out); | ||
935 | extern const ASN1_ITEM PKCS8_PRIV_KEY_INFO_it; | ||
936 | |||
937 | EVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8); | ||
938 | PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey); | ||
939 | |||
940 | int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, int version, | ||
941 | int ptype, void *pval, unsigned char *penc, int penclen); | ||
942 | int PKCS8_pkey_get0(const ASN1_OBJECT **ppkalg, const unsigned char **pk, | ||
943 | int *ppklen, const X509_ALGOR **pa, const PKCS8_PRIV_KEY_INFO *p8); | ||
944 | |||
945 | const STACK_OF(X509_ATTRIBUTE) *PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8); | ||
946 | int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type, | ||
947 | const unsigned char *bytes, int len); | ||
948 | |||
949 | int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, int ptype, | ||
950 | void *pval, unsigned char *penc, int penclen); | ||
951 | int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, const unsigned char **pk, | ||
952 | int *ppklen, X509_ALGOR **pa, X509_PUBKEY *pub); | ||
953 | |||
954 | int X509_up_ref(X509 *x); | ||
955 | STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain); | ||
956 | |||
957 | void ERR_load_X509_strings(void); | ||
958 | |||
959 | /* Error codes for the X509 functions. */ | ||
960 | |||
961 | /* Function codes. */ | ||
962 | #define X509_F_ADD_CERT_DIR 100 | ||
963 | #define X509_F_BY_FILE_CTRL 101 | ||
964 | #define X509_F_CHECK_POLICY 145 | ||
965 | #define X509_F_DIR_CTRL 102 | ||
966 | #define X509_F_GET_CERT_BY_SUBJECT 103 | ||
967 | #define X509_F_NETSCAPE_SPKI_B64_DECODE 129 | ||
968 | #define X509_F_NETSCAPE_SPKI_B64_ENCODE 130 | ||
969 | #define X509_F_X509AT_ADD1_ATTR 135 | ||
970 | #define X509_F_X509V3_ADD_EXT 104 | ||
971 | #define X509_F_X509_ATTRIBUTE_CREATE_BY_NID 136 | ||
972 | #define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 137 | ||
973 | #define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 140 | ||
974 | #define X509_F_X509_ATTRIBUTE_GET0_DATA 139 | ||
975 | #define X509_F_X509_ATTRIBUTE_SET1_DATA 138 | ||
976 | #define X509_F_X509_CHECK_PRIVATE_KEY 128 | ||
977 | #define X509_F_X509_CRL_PRINT_FP 147 | ||
978 | #define X509_F_X509_EXTENSION_CREATE_BY_NID 108 | ||
979 | #define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 | ||
980 | #define X509_F_X509_GET_PUBKEY_PARAMETERS 110 | ||
981 | #define X509_F_X509_LOAD_CERT_CRL_FILE 132 | ||
982 | #define X509_F_X509_LOAD_CERT_FILE 111 | ||
983 | #define X509_F_X509_LOAD_CRL_FILE 112 | ||
984 | #define X509_F_X509_NAME_ADD_ENTRY 113 | ||
985 | #define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 | ||
986 | #define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT 131 | ||
987 | #define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 | ||
988 | #define X509_F_X509_NAME_ONELINE 116 | ||
989 | #define X509_F_X509_NAME_PRINT 117 | ||
990 | #define X509_F_X509_PRINT_EX_FP 118 | ||
991 | #define X509_F_X509_PUBKEY_GET 119 | ||
992 | #define X509_F_X509_PUBKEY_SET 120 | ||
993 | #define X509_F_X509_REQ_CHECK_PRIVATE_KEY 144 | ||
994 | #define X509_F_X509_REQ_PRINT_EX 121 | ||
995 | #define X509_F_X509_REQ_PRINT_FP 122 | ||
996 | #define X509_F_X509_REQ_TO_X509 123 | ||
997 | #define X509_F_X509_STORE_ADD_CERT 124 | ||
998 | #define X509_F_X509_STORE_ADD_CRL 125 | ||
999 | #define X509_F_X509_STORE_CTX_GET1_ISSUER 146 | ||
1000 | #define X509_F_X509_STORE_CTX_INIT 143 | ||
1001 | #define X509_F_X509_STORE_CTX_NEW 142 | ||
1002 | #define X509_F_X509_STORE_CTX_PURPOSE_INHERIT 134 | ||
1003 | #define X509_F_X509_TO_X509_REQ 126 | ||
1004 | #define X509_F_X509_TRUST_ADD 133 | ||
1005 | #define X509_F_X509_TRUST_SET 141 | ||
1006 | #define X509_F_X509_VERIFY_CERT 127 | ||
1007 | |||
1008 | /* Reason codes. */ | ||
1009 | #define X509_R_BAD_X509_FILETYPE 100 | ||
1010 | #define X509_R_BASE64_DECODE_ERROR 118 | ||
1011 | #define X509_R_CANT_CHECK_DH_KEY 114 | ||
1012 | #define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 | ||
1013 | #define X509_R_ERR_ASN1_LIB 102 | ||
1014 | #define X509_R_INVALID_DIRECTORY 113 | ||
1015 | #define X509_R_INVALID_FIELD_NAME 119 | ||
1016 | #define X509_R_INVALID_TRUST 123 | ||
1017 | #define X509_R_INVALID_VERSION 137 | ||
1018 | #define X509_R_KEY_TYPE_MISMATCH 115 | ||
1019 | #define X509_R_KEY_VALUES_MISMATCH 116 | ||
1020 | #define X509_R_LOADING_CERT_DIR 103 | ||
1021 | #define X509_R_LOADING_DEFAULTS 104 | ||
1022 | #define X509_R_METHOD_NOT_SUPPORTED 124 | ||
1023 | #define X509_R_NO_CERTIFICATE_OR_CRL_FOUND 136 | ||
1024 | #define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 | ||
1025 | #define X509_R_PUBLIC_KEY_DECODE_ERROR 125 | ||
1026 | #define X509_R_PUBLIC_KEY_ENCODE_ERROR 126 | ||
1027 | #define X509_R_SHOULD_RETRY 106 | ||
1028 | #define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 | ||
1029 | #define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 | ||
1030 | #define X509_R_UNKNOWN_KEY_TYPE 117 | ||
1031 | #define X509_R_UNKNOWN_NID 109 | ||
1032 | #define X509_R_UNKNOWN_PURPOSE_ID 121 | ||
1033 | #define X509_R_UNKNOWN_TRUST_ID 120 | ||
1034 | #define X509_R_UNSUPPORTED_ALGORITHM 111 | ||
1035 | #define X509_R_WRONG_LOOKUP_TYPE 112 | ||
1036 | #define X509_R_WRONG_TYPE 122 | ||
1037 | |||
1038 | #ifdef __cplusplus | ||
1039 | } | ||
1040 | #endif | ||
1041 | #endif | ||