diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib/libcrypto/pem/pem.h | 546 |
1 files changed, 0 insertions, 546 deletions
diff --git a/src/lib/libcrypto/pem/pem.h b/src/lib/libcrypto/pem/pem.h deleted file mode 100644 index 4fdab48bb2..0000000000 --- a/src/lib/libcrypto/pem/pem.h +++ /dev/null | |||
@@ -1,546 +0,0 @@ | |||
1 | /* $OpenBSD: pem.h,v 1.28 2024/05/11 05:41:28 tb Exp $ */ | ||
2 | /* Copyright (C) 1995-1997 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_PEM_H | ||
60 | #define HEADER_PEM_H | ||
61 | |||
62 | #include <openssl/opensslconf.h> | ||
63 | |||
64 | #ifndef OPENSSL_NO_BIO | ||
65 | #include <openssl/bio.h> | ||
66 | #endif | ||
67 | #ifndef OPENSSL_NO_STACK | ||
68 | #include <openssl/stack.h> | ||
69 | #endif | ||
70 | #include <openssl/evp.h> | ||
71 | #include <openssl/x509.h> | ||
72 | |||
73 | #ifdef __cplusplus | ||
74 | extern "C" { | ||
75 | #endif | ||
76 | |||
77 | #define PEM_BUFSIZE 1024 | ||
78 | |||
79 | #define PEM_OBJ_UNDEF 0 | ||
80 | #define PEM_OBJ_X509 1 | ||
81 | #define PEM_OBJ_X509_REQ 2 | ||
82 | #define PEM_OBJ_CRL 3 | ||
83 | #define PEM_OBJ_SSL_SESSION 4 | ||
84 | #define PEM_OBJ_PRIV_KEY 10 | ||
85 | #define PEM_OBJ_PRIV_RSA 11 | ||
86 | #define PEM_OBJ_PRIV_DSA 12 | ||
87 | #define PEM_OBJ_PRIV_DH 13 | ||
88 | #define PEM_OBJ_PUB_RSA 14 | ||
89 | #define PEM_OBJ_PUB_DSA 15 | ||
90 | #define PEM_OBJ_PUB_DH 16 | ||
91 | #define PEM_OBJ_DHPARAMS 17 | ||
92 | #define PEM_OBJ_DSAPARAMS 18 | ||
93 | #define PEM_OBJ_PRIV_RSA_PUBLIC 19 | ||
94 | #define PEM_OBJ_PRIV_ECDSA 20 | ||
95 | #define PEM_OBJ_PUB_ECDSA 21 | ||
96 | #define PEM_OBJ_ECPARAMETERS 22 | ||
97 | |||
98 | #define PEM_ERROR 30 | ||
99 | #define PEM_DEK_DES_CBC 40 | ||
100 | #define PEM_DEK_IDEA_CBC 45 | ||
101 | #define PEM_DEK_DES_EDE 50 | ||
102 | #define PEM_DEK_DES_ECB 60 | ||
103 | #define PEM_DEK_RSA 70 | ||
104 | #define PEM_DEK_RSA_MD2 80 | ||
105 | #define PEM_DEK_RSA_MD5 90 | ||
106 | |||
107 | #define PEM_MD_MD2 NID_md2 | ||
108 | #define PEM_MD_MD5 NID_md5 | ||
109 | #define PEM_MD_SHA NID_sha | ||
110 | #define PEM_MD_MD2_RSA NID_md2WithRSAEncryption | ||
111 | #define PEM_MD_MD5_RSA NID_md5WithRSAEncryption | ||
112 | #define PEM_MD_SHA_RSA NID_sha1WithRSAEncryption | ||
113 | |||
114 | #define PEM_STRING_X509_OLD "X509 CERTIFICATE" | ||
115 | #define PEM_STRING_X509 "CERTIFICATE" | ||
116 | #define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" | ||
117 | #define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" | ||
118 | #define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" | ||
119 | #define PEM_STRING_X509_CRL "X509 CRL" | ||
120 | #define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" | ||
121 | #define PEM_STRING_PUBLIC "PUBLIC KEY" | ||
122 | #define PEM_STRING_RSA "RSA PRIVATE KEY" | ||
123 | #define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" | ||
124 | #define PEM_STRING_DSA "DSA PRIVATE KEY" | ||
125 | #define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY" | ||
126 | #define PEM_STRING_PKCS7 "PKCS7" | ||
127 | #define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA" | ||
128 | #define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" | ||
129 | #define PEM_STRING_PKCS8INF "PRIVATE KEY" | ||
130 | #define PEM_STRING_DHPARAMS "DH PARAMETERS" | ||
131 | #define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" | ||
132 | #define PEM_STRING_DSAPARAMS "DSA PARAMETERS" | ||
133 | #define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" | ||
134 | #define PEM_STRING_ECPARAMETERS "EC PARAMETERS" | ||
135 | #define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" | ||
136 | #define PEM_STRING_PARAMETERS "PARAMETERS" | ||
137 | #define PEM_STRING_CMS "CMS" | ||
138 | |||
139 | /* enc_type is one off */ | ||
140 | #define PEM_TYPE_ENCRYPTED 10 | ||
141 | #define PEM_TYPE_MIC_ONLY 20 | ||
142 | #define PEM_TYPE_MIC_CLEAR 30 | ||
143 | #define PEM_TYPE_CLEAR 40 | ||
144 | |||
145 | #ifndef LIBRESSL_INTERNAL | ||
146 | /* These macros make the PEM_read/PEM_write functions easier to maintain and | ||
147 | * write. Now they are all implemented with either: | ||
148 | * IMPLEMENT_PEM_rw(...) or IMPLEMENT_PEM_rw_cb(...) | ||
149 | */ | ||
150 | |||
151 | #define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ | ||
152 | type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ | ||
153 | { \ | ||
154 | return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \ | ||
155 | } | ||
156 | |||
157 | #define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ | ||
158 | int PEM_write_##name(FILE *fp, type *x) \ | ||
159 | { \ | ||
160 | return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \ | ||
161 | } | ||
162 | |||
163 | #define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ | ||
164 | int PEM_write_##name(FILE *fp, const type *x) \ | ||
165 | { \ | ||
166 | return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \ | ||
167 | } | ||
168 | |||
169 | #define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ | ||
170 | int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ | ||
171 | unsigned char *kstr, int klen, pem_password_cb *cb, \ | ||
172 | void *u) \ | ||
173 | { \ | ||
174 | return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ | ||
175 | } | ||
176 | |||
177 | #define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ | ||
178 | int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ | ||
179 | unsigned char *kstr, int klen, pem_password_cb *cb, \ | ||
180 | void *u) \ | ||
181 | { \ | ||
182 | return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ | ||
183 | } | ||
184 | |||
185 | |||
186 | #define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ | ||
187 | type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ | ||
188 | { \ | ||
189 | return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \ | ||
190 | } | ||
191 | |||
192 | #define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ | ||
193 | int PEM_write_bio_##name(BIO *bp, type *x) \ | ||
194 | { \ | ||
195 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \ | ||
196 | } | ||
197 | |||
198 | #define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ | ||
199 | int PEM_write_bio_##name(BIO *bp, const type *x) \ | ||
200 | { \ | ||
201 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \ | ||
202 | } | ||
203 | |||
204 | #define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ | ||
205 | int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | ||
206 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ | ||
207 | { \ | ||
208 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \ | ||
209 | } | ||
210 | |||
211 | #define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ | ||
212 | int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | ||
213 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ | ||
214 | { \ | ||
215 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \ | ||
216 | } | ||
217 | |||
218 | #define IMPLEMENT_PEM_write(name, type, str, asn1) \ | ||
219 | IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ | ||
220 | IMPLEMENT_PEM_write_fp(name, type, str, asn1) | ||
221 | |||
222 | #define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ | ||
223 | IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ | ||
224 | IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) | ||
225 | |||
226 | #define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ | ||
227 | IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ | ||
228 | IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) | ||
229 | |||
230 | #define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ | ||
231 | IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ | ||
232 | IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) | ||
233 | |||
234 | #define IMPLEMENT_PEM_read(name, type, str, asn1) \ | ||
235 | IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ | ||
236 | IMPLEMENT_PEM_read_fp(name, type, str, asn1) | ||
237 | |||
238 | #define IMPLEMENT_PEM_rw(name, type, str, asn1) \ | ||
239 | IMPLEMENT_PEM_read(name, type, str, asn1) \ | ||
240 | IMPLEMENT_PEM_write(name, type, str, asn1) | ||
241 | |||
242 | #define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ | ||
243 | IMPLEMENT_PEM_read(name, type, str, asn1) \ | ||
244 | IMPLEMENT_PEM_write_const(name, type, str, asn1) | ||
245 | |||
246 | #define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ | ||
247 | IMPLEMENT_PEM_read(name, type, str, asn1) \ | ||
248 | IMPLEMENT_PEM_write_cb(name, type, str, asn1) | ||
249 | |||
250 | #endif | ||
251 | |||
252 | /* These are the same except they are for the declarations */ | ||
253 | |||
254 | |||
255 | #define DECLARE_PEM_read_fp(name, type) \ | ||
256 | type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u); | ||
257 | |||
258 | #define DECLARE_PEM_write_fp(name, type) \ | ||
259 | int PEM_write_##name(FILE *fp, type *x); | ||
260 | |||
261 | #define DECLARE_PEM_write_fp_const(name, type) \ | ||
262 | int PEM_write_##name(FILE *fp, const type *x); | ||
263 | |||
264 | #define DECLARE_PEM_write_cb_fp(name, type) \ | ||
265 | int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ | ||
266 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u); | ||
267 | |||
268 | |||
269 | #ifndef OPENSSL_NO_BIO | ||
270 | #define DECLARE_PEM_read_bio(name, type) \ | ||
271 | type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u); | ||
272 | |||
273 | #define DECLARE_PEM_write_bio(name, type) \ | ||
274 | int PEM_write_bio_##name(BIO *bp, type *x); | ||
275 | |||
276 | #define DECLARE_PEM_write_bio_const(name, type) \ | ||
277 | int PEM_write_bio_##name(BIO *bp, const type *x); | ||
278 | |||
279 | #define DECLARE_PEM_write_cb_bio(name, type) \ | ||
280 | int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | ||
281 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u); | ||
282 | |||
283 | #else | ||
284 | |||
285 | #define DECLARE_PEM_read_bio(name, type) /**/ | ||
286 | #define DECLARE_PEM_write_bio(name, type) /**/ | ||
287 | #define DECLARE_PEM_write_bio_const(name, type) /**/ | ||
288 | #define DECLARE_PEM_write_cb_bio(name, type) /**/ | ||
289 | |||
290 | #endif | ||
291 | |||
292 | #define DECLARE_PEM_write(name, type) \ | ||
293 | DECLARE_PEM_write_bio(name, type) \ | ||
294 | DECLARE_PEM_write_fp(name, type) | ||
295 | |||
296 | #define DECLARE_PEM_write_const(name, type) \ | ||
297 | DECLARE_PEM_write_bio_const(name, type) \ | ||
298 | DECLARE_PEM_write_fp_const(name, type) | ||
299 | |||
300 | #define DECLARE_PEM_write_cb(name, type) \ | ||
301 | DECLARE_PEM_write_cb_bio(name, type) \ | ||
302 | DECLARE_PEM_write_cb_fp(name, type) | ||
303 | |||
304 | #define DECLARE_PEM_read(name, type) \ | ||
305 | DECLARE_PEM_read_bio(name, type) \ | ||
306 | DECLARE_PEM_read_fp(name, type) | ||
307 | |||
308 | #define DECLARE_PEM_rw(name, type) \ | ||
309 | DECLARE_PEM_read(name, type) \ | ||
310 | DECLARE_PEM_write(name, type) | ||
311 | |||
312 | #define DECLARE_PEM_rw_const(name, type) \ | ||
313 | DECLARE_PEM_read(name, type) \ | ||
314 | DECLARE_PEM_write_const(name, type) | ||
315 | |||
316 | #define DECLARE_PEM_rw_cb(name, type) \ | ||
317 | DECLARE_PEM_read(name, type) \ | ||
318 | DECLARE_PEM_write_cb(name, type) | ||
319 | |||
320 | typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata); | ||
321 | |||
322 | int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); | ||
323 | int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data, long *len, | ||
324 | pem_password_cb *callback, void *u); | ||
325 | |||
326 | #ifndef OPENSSL_NO_BIO | ||
327 | int PEM_read_bio(BIO *bp, char **name, char **header, | ||
328 | unsigned char **data, long *len); | ||
329 | int PEM_write_bio(BIO *bp, const char *name, const char *hdr, | ||
330 | const unsigned char *data, long len); | ||
331 | int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, | ||
332 | const char *name, BIO *bp, pem_password_cb *cb, void *u); | ||
333 | void * PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, | ||
334 | void **x, pem_password_cb *cb, void *u); | ||
335 | int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x, | ||
336 | const EVP_CIPHER *enc, unsigned char *kstr, int klen, | ||
337 | pem_password_cb *cb, void *u); | ||
338 | |||
339 | STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, | ||
340 | STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u); | ||
341 | int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, | ||
342 | unsigned char *kstr, int klen, pem_password_cb *cd, void *u); | ||
343 | #endif | ||
344 | |||
345 | int PEM_read(FILE *fp, char **name, char **header, | ||
346 | unsigned char **data, long *len); | ||
347 | int PEM_write(FILE *fp, const char *name, const char *hdr, | ||
348 | const unsigned char *data, long len); | ||
349 | void * PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, | ||
350 | pem_password_cb *cb, void *u); | ||
351 | int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, | ||
352 | void *x, const EVP_CIPHER *enc, unsigned char *kstr, | ||
353 | int klen, pem_password_cb *callback, void *u); | ||
354 | STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, | ||
355 | pem_password_cb *cb, void *u); | ||
356 | |||
357 | int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); | ||
358 | int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt); | ||
359 | int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, | ||
360 | unsigned int *siglen, EVP_PKEY *pkey); | ||
361 | |||
362 | int PEM_def_callback(char *buf, int num, int w, void *key); | ||
363 | void PEM_proc_type(char *buf, int type); | ||
364 | void PEM_dek_info(char *buf, const char *type, int len, char *str); | ||
365 | |||
366 | |||
367 | DECLARE_PEM_rw(X509, X509) | ||
368 | |||
369 | DECLARE_PEM_rw(X509_AUX, X509) | ||
370 | |||
371 | DECLARE_PEM_rw(X509_REQ, X509_REQ) | ||
372 | DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) | ||
373 | |||
374 | DECLARE_PEM_rw(X509_CRL, X509_CRL) | ||
375 | |||
376 | DECLARE_PEM_rw(PKCS7, PKCS7) | ||
377 | |||
378 | DECLARE_PEM_rw(PKCS8, X509_SIG) | ||
379 | |||
380 | DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) | ||
381 | |||
382 | #ifndef OPENSSL_NO_RSA | ||
383 | |||
384 | DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) | ||
385 | |||
386 | DECLARE_PEM_rw_const(RSAPublicKey, RSA) | ||
387 | DECLARE_PEM_rw(RSA_PUBKEY, RSA) | ||
388 | |||
389 | #endif | ||
390 | |||
391 | #ifndef OPENSSL_NO_DSA | ||
392 | |||
393 | DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) | ||
394 | |||
395 | DECLARE_PEM_rw(DSA_PUBKEY, DSA) | ||
396 | |||
397 | DECLARE_PEM_rw_const(DSAparams, DSA) | ||
398 | |||
399 | #endif | ||
400 | |||
401 | #ifndef OPENSSL_NO_EC | ||
402 | DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP) | ||
403 | DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY) | ||
404 | DECLARE_PEM_rw(EC_PUBKEY, EC_KEY) | ||
405 | #endif | ||
406 | |||
407 | #ifndef OPENSSL_NO_DH | ||
408 | |||
409 | DECLARE_PEM_rw_const(DHparams, DH) | ||
410 | |||
411 | #endif | ||
412 | |||
413 | DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY) | ||
414 | |||
415 | DECLARE_PEM_rw(PUBKEY, EVP_PKEY) | ||
416 | |||
417 | int PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x, | ||
418 | const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, | ||
419 | void *u); | ||
420 | int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, | ||
421 | char *kstr, int klen, | ||
422 | pem_password_cb *cb, void *u); | ||
423 | int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *, | ||
424 | char *, int, pem_password_cb *, void *); | ||
425 | int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, | ||
426 | char *kstr, int klen, | ||
427 | pem_password_cb *cb, void *u); | ||
428 | int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, | ||
429 | char *kstr, int klen, | ||
430 | pem_password_cb *cb, void *u); | ||
431 | EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, | ||
432 | void *u); | ||
433 | |||
434 | int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, | ||
435 | char *kstr, int klen, | ||
436 | pem_password_cb *cb, void *u); | ||
437 | int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, | ||
438 | char *kstr, int klen, | ||
439 | pem_password_cb *cb, void *u); | ||
440 | int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, | ||
441 | char *kstr, int klen, | ||
442 | pem_password_cb *cb, void *u); | ||
443 | |||
444 | EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, | ||
445 | void *u); | ||
446 | |||
447 | int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, | ||
448 | char *kstr, int klen, pem_password_cb *cd, void *u); | ||
449 | |||
450 | EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x); | ||
451 | int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x); | ||
452 | |||
453 | |||
454 | EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length); | ||
455 | EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length); | ||
456 | EVP_PKEY *b2i_PrivateKey_bio(BIO *in); | ||
457 | EVP_PKEY *b2i_PublicKey_bio(BIO *in); | ||
458 | int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk); | ||
459 | int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk); | ||
460 | #ifndef OPENSSL_NO_RC4 | ||
461 | EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u); | ||
462 | int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, pem_password_cb *cb, | ||
463 | void *u); | ||
464 | #endif | ||
465 | |||
466 | |||
467 | void ERR_load_PEM_strings(void); | ||
468 | |||
469 | /* Error codes for the PEM functions. */ | ||
470 | |||
471 | /* Function codes. */ | ||
472 | #define PEM_F_B2I_DSS 127 | ||
473 | #define PEM_F_B2I_PVK_BIO 128 | ||
474 | #define PEM_F_B2I_RSA 129 | ||
475 | #define PEM_F_CHECK_BITLEN_DSA 130 | ||
476 | #define PEM_F_CHECK_BITLEN_RSA 131 | ||
477 | #define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120 | ||
478 | #define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121 | ||
479 | #define PEM_F_DO_B2I 132 | ||
480 | #define PEM_F_DO_B2I_BIO 133 | ||
481 | #define PEM_F_DO_BLOB_HEADER 134 | ||
482 | #define PEM_F_DO_PK8PKEY 126 | ||
483 | #define PEM_F_DO_PK8PKEY_FP 125 | ||
484 | #define PEM_F_DO_PVK_BODY 135 | ||
485 | #define PEM_F_DO_PVK_HEADER 136 | ||
486 | #define PEM_F_I2B_PVK 137 | ||
487 | #define PEM_F_I2B_PVK_BIO 138 | ||
488 | #define PEM_F_LOAD_IV 101 | ||
489 | #define PEM_F_PEM_ASN1_READ 102 | ||
490 | #define PEM_F_PEM_ASN1_READ_BIO 103 | ||
491 | #define PEM_F_PEM_ASN1_WRITE 104 | ||
492 | #define PEM_F_PEM_ASN1_WRITE_BIO 105 | ||
493 | #define PEM_F_PEM_DEF_CALLBACK 100 | ||
494 | #define PEM_F_PEM_DO_HEADER 106 | ||
495 | #define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY 118 | ||
496 | #define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 | ||
497 | #define PEM_F_PEM_PK8PKEY 119 | ||
498 | #define PEM_F_PEM_READ 108 | ||
499 | #define PEM_F_PEM_READ_BIO 109 | ||
500 | #define PEM_F_PEM_READ_BIO_PARAMETERS 140 | ||
501 | #define PEM_F_PEM_READ_BIO_PRIVATEKEY 123 | ||
502 | #define PEM_F_PEM_READ_PRIVATEKEY 124 | ||
503 | #define PEM_F_PEM_SEALFINAL 110 | ||
504 | #define PEM_F_PEM_SEALINIT 111 | ||
505 | #define PEM_F_PEM_SIGNFINAL 112 | ||
506 | #define PEM_F_PEM_WRITE 113 | ||
507 | #define PEM_F_PEM_WRITE_BIO 114 | ||
508 | #define PEM_F_PEM_WRITE_PRIVATEKEY 139 | ||
509 | #define PEM_F_PEM_X509_INFO_READ 115 | ||
510 | #define PEM_F_PEM_X509_INFO_READ_BIO 116 | ||
511 | #define PEM_F_PEM_X509_INFO_WRITE_BIO 117 | ||
512 | |||
513 | /* Reason codes. */ | ||
514 | #define PEM_R_BAD_BASE64_DECODE 100 | ||
515 | #define PEM_R_BAD_DECRYPT 101 | ||
516 | #define PEM_R_BAD_END_LINE 102 | ||
517 | #define PEM_R_BAD_IV_CHARS 103 | ||
518 | #define PEM_R_BAD_MAGIC_NUMBER 116 | ||
519 | #define PEM_R_BAD_PASSWORD_READ 104 | ||
520 | #define PEM_R_BAD_VERSION_NUMBER 117 | ||
521 | #define PEM_R_BIO_WRITE_FAILURE 118 | ||
522 | #define PEM_R_CIPHER_IS_NULL 127 | ||
523 | #define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115 | ||
524 | #define PEM_R_EXPECTING_PRIVATE_KEY_BLOB 119 | ||
525 | #define PEM_R_EXPECTING_PUBLIC_KEY_BLOB 120 | ||
526 | #define PEM_R_INCONSISTENT_HEADER 121 | ||
527 | #define PEM_R_KEYBLOB_HEADER_PARSE_ERROR 122 | ||
528 | #define PEM_R_KEYBLOB_TOO_SHORT 123 | ||
529 | #define PEM_R_NOT_DEK_INFO 105 | ||
530 | #define PEM_R_NOT_ENCRYPTED 106 | ||
531 | #define PEM_R_NOT_PROC_TYPE 107 | ||
532 | #define PEM_R_NO_START_LINE 108 | ||
533 | #define PEM_R_PROBLEMS_GETTING_PASSWORD 109 | ||
534 | #define PEM_R_PUBLIC_KEY_NO_RSA 110 | ||
535 | #define PEM_R_PVK_DATA_TOO_SHORT 124 | ||
536 | #define PEM_R_PVK_TOO_SHORT 125 | ||
537 | #define PEM_R_READ_KEY 111 | ||
538 | #define PEM_R_SHORT_HEADER 112 | ||
539 | #define PEM_R_UNSUPPORTED_CIPHER 113 | ||
540 | #define PEM_R_UNSUPPORTED_ENCRYPTION 114 | ||
541 | #define PEM_R_UNSUPPORTED_KEY_COMPONENTS 126 | ||
542 | |||
543 | #ifdef __cplusplus | ||
544 | } | ||
545 | #endif | ||
546 | #endif | ||