]>
Commit | Line | Data |
---|---|---|
21dcbebc | 1 | /* |
6738bf14 | 2 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. |
d02b48c6 | 3 | * |
48f4ad77 | 4 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
21dcbebc RS |
5 | * this file except in compliance with the License. You can obtain a copy |
6 | * in the file LICENSE in the source distribution or at | |
7 | * https://www.openssl.org/source/license.html | |
d02b48c6 RE |
8 | */ |
9 | ||
ae4186b0 DMSP |
10 | #ifndef OPENSSL_PEM_H |
11 | # define OPENSSL_PEM_H | |
d86167ec DMSP |
12 | # pragma once |
13 | ||
14 | # include <openssl/macros.h> | |
936c2b9e | 15 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
d86167ec DMSP |
16 | # define HEADER_PEM_H |
17 | # endif | |
0f113f3e MC |
18 | |
19 | # include <openssl/e_os2.h> | |
a00ae6c4 | 20 | # include <openssl/bio.h> |
af3e5e1b | 21 | # include <openssl/safestack.h> |
0f113f3e MC |
22 | # include <openssl/evp.h> |
23 | # include <openssl/x509.h> | |
52df25cf | 24 | # include <openssl/pemerr.h> |
d02b48c6 | 25 | |
82271cee RL |
26 | #ifdef __cplusplus |
27 | extern "C" { | |
28 | #endif | |
29 | ||
0f113f3e MC |
30 | # define PEM_BUFSIZE 1024 |
31 | ||
0f113f3e MC |
32 | # define PEM_STRING_X509_OLD "X509 CERTIFICATE" |
33 | # define PEM_STRING_X509 "CERTIFICATE" | |
0f113f3e MC |
34 | # define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" |
35 | # define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" | |
36 | # define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" | |
37 | # define PEM_STRING_X509_CRL "X509 CRL" | |
38 | # define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" | |
39 | # define PEM_STRING_PUBLIC "PUBLIC KEY" | |
40 | # define PEM_STRING_RSA "RSA PRIVATE KEY" | |
41 | # define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" | |
42 | # define PEM_STRING_DSA "DSA PRIVATE KEY" | |
43 | # define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY" | |
44 | # define PEM_STRING_PKCS7 "PKCS7" | |
45 | # define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA" | |
46 | # define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" | |
47 | # define PEM_STRING_PKCS8INF "PRIVATE KEY" | |
48 | # define PEM_STRING_DHPARAMS "DH PARAMETERS" | |
49 | # define PEM_STRING_DHXPARAMS "X9.42 DH PARAMETERS" | |
50 | # define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" | |
51 | # define PEM_STRING_DSAPARAMS "DSA PARAMETERS" | |
52 | # define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" | |
53 | # define PEM_STRING_ECPARAMETERS "EC PARAMETERS" | |
54 | # define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" | |
55 | # define PEM_STRING_PARAMETERS "PARAMETERS" | |
56 | # define PEM_STRING_CMS "CMS" | |
57 | ||
0f113f3e MC |
58 | # define PEM_TYPE_ENCRYPTED 10 |
59 | # define PEM_TYPE_MIC_ONLY 20 | |
60 | # define PEM_TYPE_MIC_CLEAR 30 | |
61 | # define PEM_TYPE_CLEAR 40 | |
62 | ||
0f113f3e MC |
63 | /* |
64 | * These macros make the PEM_read/PEM_write functions easier to maintain and | |
65 | * write. Now they are all implemented with either: IMPLEMENT_PEM_rw(...) or | |
66 | * IMPLEMENT_PEM_rw_cb(...) | |
f62676b9 DSH |
67 | */ |
68 | ||
0f113f3e | 69 | # ifdef OPENSSL_NO_STDIO |
f62676b9 | 70 | |
0f113f3e MC |
71 | # define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/ |
72 | # define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/ | |
de0799b0 RL |
73 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
74 | # define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/ | |
75 | # endif | |
0f113f3e | 76 | # define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/ |
de0799b0 RL |
77 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
78 | # define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/ | |
79 | # endif | |
0f113f3e | 80 | # else |
f62676b9 | 81 | |
de0799b0 RL |
82 | # define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ |
83 | type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u) \ | |
84 | { \ | |
85 | return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str, fp, \ | |
86 | (void **)x, cb, u); \ | |
87 | } | |
88 | ||
89 | # define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ | |
90 | int PEM_write_##name(FILE *fp, const type *x) \ | |
91 | { \ | |
92 | return PEM_ASN1_write((i2d_of_void *)i2d_##asn1, str, fp, \ | |
93 | x, NULL, NULL, 0, NULL, NULL); \ | |
94 | } | |
95 | ||
96 | # ifndef OPENSSL_NO_DEPRECATED_3_0 | |
97 | # define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ | |
98 | IMPLEMENT_PEM_write_fp(name, type, str, asn1) | |
99 | # endif | |
f62676b9 | 100 | |
de0799b0 RL |
101 | # define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ |
102 | int PEM_write_##name(FILE *fp, const type *x, \ | |
103 | const EVP_CIPHER *enc, \ | |
104 | const unsigned char *kstr, int klen, \ | |
105 | pem_password_cb *cb, void *u) \ | |
106 | { \ | |
107 | return PEM_ASN1_write((i2d_of_void *)i2d_##asn1, str, fp, \ | |
108 | x, enc, kstr, klen, cb, u); \ | |
109 | } | |
110 | ||
111 | # ifndef OPENSSL_NO_DEPRECATED_3_0 | |
112 | # define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ | |
113 | IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) | |
114 | # endif | |
0f113f3e | 115 | # endif |
f62676b9 | 116 | |
de0799b0 RL |
117 | # define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ |
118 | type *PEM_read_bio_##name(BIO *bp, type **x, \ | |
119 | pem_password_cb *cb, void *u) \ | |
120 | { \ | |
121 | return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str, bp, \ | |
122 | (void **)x, cb, u); \ | |
123 | } | |
124 | ||
125 | # define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ | |
126 | int PEM_write_bio_##name(BIO *bp, const type *x) \ | |
127 | { \ | |
128 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1, str, bp, \ | |
129 | x, NULL,NULL,0,NULL,NULL); \ | |
130 | } | |
41a15c4f | 131 | |
de0799b0 RL |
132 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
133 | # define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ | |
134 | IMPLEMENT_PEM_write_bio(name, type, str, asn1) | |
135 | # endif | |
f62676b9 | 136 | |
de0799b0 RL |
137 | # define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ |
138 | int PEM_write_bio_##name(BIO *bp, const type *x, \ | |
139 | const EVP_CIPHER *enc, \ | |
140 | const unsigned char *kstr, int klen, \ | |
141 | pem_password_cb *cb, void *u) \ | |
142 | { \ | |
143 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1, str, bp, \ | |
144 | x, enc, kstr, klen, cb, u); \ | |
145 | } | |
41a15c4f | 146 | |
de0799b0 RL |
147 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
148 | # define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ | |
149 | IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) | |
150 | # endif | |
f62676b9 | 151 | |
0f113f3e MC |
152 | # define IMPLEMENT_PEM_write(name, type, str, asn1) \ |
153 | IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ | |
154 | IMPLEMENT_PEM_write_fp(name, type, str, asn1) | |
f62676b9 | 155 | |
de0799b0 RL |
156 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
157 | # define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ | |
0f113f3e MC |
158 | IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ |
159 | IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) | |
de0799b0 | 160 | # endif |
41a15c4f | 161 | |
0f113f3e MC |
162 | # define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ |
163 | IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ | |
164 | IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) | |
f62676b9 | 165 | |
de0799b0 RL |
166 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
167 | # define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ | |
0f113f3e MC |
168 | IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ |
169 | IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) | |
de0799b0 | 170 | # endif |
41a15c4f | 171 | |
0f113f3e MC |
172 | # define IMPLEMENT_PEM_read(name, type, str, asn1) \ |
173 | IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ | |
174 | IMPLEMENT_PEM_read_fp(name, type, str, asn1) | |
f62676b9 | 175 | |
0f113f3e MC |
176 | # define IMPLEMENT_PEM_rw(name, type, str, asn1) \ |
177 | IMPLEMENT_PEM_read(name, type, str, asn1) \ | |
178 | IMPLEMENT_PEM_write(name, type, str, asn1) | |
f62676b9 | 179 | |
de0799b0 RL |
180 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
181 | # define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ | |
0f113f3e MC |
182 | IMPLEMENT_PEM_read(name, type, str, asn1) \ |
183 | IMPLEMENT_PEM_write_const(name, type, str, asn1) | |
de0799b0 | 184 | # endif |
41a15c4f | 185 | |
0f113f3e MC |
186 | # define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ |
187 | IMPLEMENT_PEM_read(name, type, str, asn1) \ | |
188 | IMPLEMENT_PEM_write_cb(name, type, str, asn1) | |
f62676b9 | 189 | |
dbd665c2 DSH |
190 | /* These are the same except they are for the declarations */ |
191 | ||
0f113f3e MC |
192 | # if defined(OPENSSL_NO_STDIO) |
193 | ||
194 | # define DECLARE_PEM_read_fp(name, type) /**/ | |
195 | # define DECLARE_PEM_write_fp(name, type) /**/ | |
de0799b0 RL |
196 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
197 | # define DECLARE_PEM_write_fp_const(name, type) /**/ | |
198 | # endif | |
0f113f3e MC |
199 | # define DECLARE_PEM_write_cb_fp(name, type) /**/ |
200 | # else | |
201 | ||
de0799b0 RL |
202 | # define DECLARE_PEM_read_fp(name, type) \ |
203 | type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u); | |
0f113f3e | 204 | |
de0799b0 RL |
205 | # define DECLARE_PEM_write_fp(name, type) \ |
206 | int PEM_write_##name(FILE *fp, const type *x); | |
0f113f3e | 207 | |
de0799b0 RL |
208 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
209 | # define DECLARE_PEM_write_fp_const(name, type) \ | |
210 | DECLARE_PEM_write_fp(name, type) | |
211 | # endif | |
0f113f3e | 212 | |
de0799b0 RL |
213 | # define DECLARE_PEM_write_cb_fp(name, type) \ |
214 | int PEM_write_##name(FILE *fp, const type *x, \ | |
215 | const EVP_CIPHER *enc, \ | |
216 | const unsigned char *kstr, int klen, \ | |
217 | pem_password_cb *cb, void *u); | |
0f113f3e MC |
218 | |
219 | # endif | |
220 | ||
de0799b0 RL |
221 | # define DECLARE_PEM_read_bio(name, type) \ |
222 | type *PEM_read_bio_##name(BIO *bp, type **x, \ | |
223 | pem_password_cb *cb, void *u); | |
0f113f3e | 224 | |
de0799b0 RL |
225 | # define DECLARE_PEM_write_bio(name, type) \ |
226 | int PEM_write_bio_##name(BIO *bp, const type *x); | |
0f113f3e | 227 | |
de0799b0 RL |
228 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
229 | # define DECLARE_PEM_write_bio_const(name, type) \ | |
230 | DECLARE_PEM_write_bio(name, type) | |
231 | # endif | |
0f113f3e | 232 | |
de0799b0 RL |
233 | # define DECLARE_PEM_write_cb_bio(name, type) \ |
234 | int PEM_write_bio_##name(BIO *bp, const type *x, \ | |
235 | const EVP_CIPHER *enc, \ | |
236 | const unsigned char *kstr, int klen, \ | |
237 | pem_password_cb *cb, void *u); | |
0f113f3e | 238 | |
0f113f3e MC |
239 | # define DECLARE_PEM_write(name, type) \ |
240 | DECLARE_PEM_write_bio(name, type) \ | |
241 | DECLARE_PEM_write_fp(name, type) | |
de0799b0 RL |
242 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
243 | # define DECLARE_PEM_write_const(name, type) \ | |
0f113f3e MC |
244 | DECLARE_PEM_write_bio_const(name, type) \ |
245 | DECLARE_PEM_write_fp_const(name, type) | |
de0799b0 | 246 | # endif |
0f113f3e MC |
247 | # define DECLARE_PEM_write_cb(name, type) \ |
248 | DECLARE_PEM_write_cb_bio(name, type) \ | |
249 | DECLARE_PEM_write_cb_fp(name, type) | |
250 | # define DECLARE_PEM_read(name, type) \ | |
251 | DECLARE_PEM_read_bio(name, type) \ | |
252 | DECLARE_PEM_read_fp(name, type) | |
253 | # define DECLARE_PEM_rw(name, type) \ | |
254 | DECLARE_PEM_read(name, type) \ | |
255 | DECLARE_PEM_write(name, type) | |
de0799b0 RL |
256 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
257 | # define DECLARE_PEM_rw_const(name, type) \ | |
0f113f3e MC |
258 | DECLARE_PEM_read(name, type) \ |
259 | DECLARE_PEM_write_const(name, type) | |
de0799b0 | 260 | # endif |
0f113f3e MC |
261 | # define DECLARE_PEM_rw_cb(name, type) \ |
262 | DECLARE_PEM_read(name, type) \ | |
263 | DECLARE_PEM_write_cb(name, type) | |
0f113f3e MC |
264 | |
265 | int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); | |
266 | int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len, | |
267 | pem_password_cb *callback, void *u); | |
268 | ||
0f113f3e MC |
269 | int PEM_read_bio(BIO *bp, char **name, char **header, |
270 | unsigned char **data, long *len); | |
204afd81 BK |
271 | # define PEM_FLAG_SECURE 0x1 |
272 | # define PEM_FLAG_EAY_COMPATIBLE 0x2 | |
273 | # define PEM_FLAG_ONLY_B64 0x4 | |
274 | int PEM_read_bio_ex(BIO *bp, char **name, char **header, | |
275 | unsigned char **data, long *len, unsigned int flags); | |
7671342e BK |
276 | int PEM_bytes_read_bio_secmem(unsigned char **pdata, long *plen, char **pnm, |
277 | const char *name, BIO *bp, pem_password_cb *cb, | |
278 | void *u); | |
0f113f3e MC |
279 | int PEM_write_bio(BIO *bp, const char *name, const char *hdr, |
280 | const unsigned char *data, long len); | |
281 | int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, | |
282 | const char *name, BIO *bp, pem_password_cb *cb, | |
283 | void *u); | |
284 | void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, | |
285 | pem_password_cb *cb, void *u); | |
de0799b0 RL |
286 | int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, |
287 | const void *x, const EVP_CIPHER *enc, | |
288 | const unsigned char *kstr, int klen, | |
0f113f3e MC |
289 | pem_password_cb *cb, void *u); |
290 | ||
291 | STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, | |
292 | pem_password_cb *cb, void *u); | |
de0799b0 RL |
293 | int PEM_X509_INFO_write_bio(BIO *bp, const X509_INFO *xi, EVP_CIPHER *enc, |
294 | const unsigned char *kstr, int klen, | |
0f113f3e | 295 | pem_password_cb *cd, void *u); |
0f113f3e | 296 | |
984d6c60 | 297 | #ifndef OPENSSL_NO_STDIO |
0f113f3e MC |
298 | int PEM_read(FILE *fp, char **name, char **header, |
299 | unsigned char **data, long *len); | |
300 | int PEM_write(FILE *fp, const char *name, const char *hdr, | |
301 | const unsigned char *data, long len); | |
302 | void *PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, | |
303 | pem_password_cb *cb, void *u); | |
304 | int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, | |
de0799b0 RL |
305 | const void *x, const EVP_CIPHER *enc, |
306 | const unsigned char *kstr, int klen, | |
307 | pem_password_cb *callback, void *u); | |
0f113f3e MC |
308 | STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, |
309 | pem_password_cb *cb, void *u); | |
984d6c60 | 310 | #endif |
0f113f3e | 311 | |
0f113f3e | 312 | int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); |
de0799b0 | 313 | int PEM_SignUpdate(EVP_MD_CTX *ctx, const unsigned char *d, unsigned int cnt); |
0f113f3e MC |
314 | int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, |
315 | unsigned int *siglen, EVP_PKEY *pkey); | |
316 | ||
d6d94d33 RL |
317 | /* The default pem_password_cb that's used internally */ |
318 | int PEM_def_callback(char *buf, int num, int rwflag, void *userdata); | |
0f113f3e | 319 | void PEM_proc_type(char *buf, int type); |
de0799b0 | 320 | void PEM_dek_info(char *buf, const char *type, int len, const char *str); |
0f113f3e MC |
321 | |
322 | # include <openssl/symhacks.h> | |
8c197cc5 | 323 | |
dbd665c2 | 324 | DECLARE_PEM_rw(X509, X509) |
ce1b4fe1 | 325 | DECLARE_PEM_rw(X509_AUX, X509) |
a8fe430a MC |
326 | DECLARE_PEM_rw(X509_REQ, X509_REQ) |
327 | DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) | |
dbd665c2 | 328 | DECLARE_PEM_rw(X509_CRL, X509_CRL) |
dbd665c2 | 329 | DECLARE_PEM_rw(PKCS7, PKCS7) |
dbd665c2 | 330 | DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE) |
dbd665c2 | 331 | DECLARE_PEM_rw(PKCS8, X509_SIG) |
dbd665c2 | 332 | DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) |
0f113f3e | 333 | # ifndef OPENSSL_NO_RSA |
dbd665c2 | 334 | DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) |
de0799b0 | 335 | DECLARE_PEM_rw(RSAPublicKey, RSA) |
a8fe430a | 336 | DECLARE_PEM_rw(RSA_PUBKEY, RSA) |
0f113f3e MC |
337 | # endif |
338 | # ifndef OPENSSL_NO_DSA | |
dbd665c2 | 339 | DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) |
a8fe430a | 340 | DECLARE_PEM_rw(DSA_PUBKEY, DSA) |
de0799b0 | 341 | DECLARE_PEM_rw(DSAparams, DSA) |
0f113f3e MC |
342 | # endif |
343 | # ifndef OPENSSL_NO_EC | |
de0799b0 | 344 | DECLARE_PEM_rw(ECPKParameters, EC_GROUP) |
a8fe430a MC |
345 | DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY) |
346 | DECLARE_PEM_rw(EC_PUBKEY, EC_KEY) | |
0f113f3e MC |
347 | # endif |
348 | # ifndef OPENSSL_NO_DH | |
de0799b0 RL |
349 | DECLARE_PEM_rw(DHparams, DH) |
350 | DECLARE_PEM_write(DHxparams, DH) | |
0f113f3e | 351 | # endif |
a8fe430a MC |
352 | DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY) |
353 | DECLARE_PEM_rw(PUBKEY, EVP_PKEY) | |
52664f50 | 354 | |
de0799b0 | 355 | int PEM_write_bio_PrivateKey_traditional(BIO *bp, const EVP_PKEY *x, |
05dba815 | 356 | const EVP_CIPHER *enc, |
de0799b0 | 357 | const unsigned char *kstr, int klen, |
05dba815 DSH |
358 | pem_password_cb *cb, void *u); |
359 | ||
de0799b0 | 360 | /* Why do these take a signed char *kstr? */ |
9fdcc21f | 361 | int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, const EVP_PKEY *x, int nid, |
de0799b0 | 362 | const char *kstr, int klen, |
0f113f3e | 363 | pem_password_cb *cb, void *u); |
9fdcc21f | 364 | int PEM_write_bio_PKCS8PrivateKey(BIO *, const EVP_PKEY *, const EVP_CIPHER *, |
de0799b0 RL |
365 | const char *kstr, int klen, |
366 | pem_password_cb *cb, void *u); | |
9fdcc21f | 367 | int i2d_PKCS8PrivateKey_bio(BIO *bp, const EVP_PKEY *x, const EVP_CIPHER *enc, |
de0799b0 | 368 | const char *kstr, int klen, |
0f113f3e | 369 | pem_password_cb *cb, void *u); |
9fdcc21f | 370 | int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, const EVP_PKEY *x, int nid, |
de0799b0 | 371 | const char *kstr, int klen, |
0f113f3e MC |
372 | pem_password_cb *cb, void *u); |
373 | EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, | |
374 | void *u); | |
525f51f6 | 375 | |
04e381ff | 376 | # ifndef OPENSSL_NO_STDIO |
9fdcc21f | 377 | int i2d_PKCS8PrivateKey_fp(FILE *fp, const EVP_PKEY *x, const EVP_CIPHER *enc, |
de0799b0 | 378 | const char *kstr, int klen, |
0f113f3e | 379 | pem_password_cb *cb, void *u); |
9fdcc21f | 380 | int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, const EVP_PKEY *x, int nid, |
de0799b0 | 381 | const char *kstr, int klen, |
0f113f3e | 382 | pem_password_cb *cb, void *u); |
9fdcc21f | 383 | int PEM_write_PKCS8PrivateKey_nid(FILE *fp, const EVP_PKEY *x, int nid, |
de0799b0 | 384 | const char *kstr, int klen, |
0f113f3e | 385 | pem_password_cb *cb, void *u); |
525f51f6 | 386 | |
0f113f3e MC |
387 | EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, |
388 | void *u); | |
525f51f6 | 389 | |
9fdcc21f | 390 | int PEM_write_PKCS8PrivateKey(FILE *fp, const EVP_PKEY *x, const EVP_CIPHER *enc, |
de0799b0 RL |
391 | const char *kstr, int klen, |
392 | pem_password_cb *cd, void *u); | |
04e381ff | 393 | # endif |
3e4585c8 | 394 | EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x); |
de0799b0 | 395 | int PEM_write_bio_Parameters(BIO *bp, const EVP_PKEY *x); |
3e4585c8 | 396 | |
54c010ab | 397 | # ifndef OPENSSL_NO_DSA |
a0156a92 DSH |
398 | EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length); |
399 | EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length); | |
400 | EVP_PKEY *b2i_PrivateKey_bio(BIO *in); | |
401 | EVP_PKEY *b2i_PublicKey_bio(BIO *in); | |
de0799b0 RL |
402 | int i2b_PrivateKey_bio(BIO *out, const EVP_PKEY *pk); |
403 | int i2b_PublicKey_bio(BIO *out, const EVP_PKEY *pk); | |
54c010ab | 404 | # ifndef OPENSSL_NO_RC4 |
a0156a92 | 405 | EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u); |
de0799b0 | 406 | int i2b_PVK_bio(BIO *out, const EVP_PKEY *pk, int enclevel, |
0f113f3e | 407 | pem_password_cb *cb, void *u); |
54c010ab | 408 | # endif |
0f113f3e | 409 | # endif |
a0156a92 | 410 | |
0cd0a820 | 411 | # ifdef __cplusplus |
d02b48c6 | 412 | } |
0cd0a820 | 413 | # endif |
d02b48c6 | 414 | #endif |