/src/openssl/include/openssl/pem.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. |
3 | | * |
4 | | * Licensed under the Apache License 2.0 (the "License"). You may not use |
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 |
8 | | */ |
9 | | |
10 | | #ifndef OPENSSL_PEM_H |
11 | | # define OPENSSL_PEM_H |
12 | | # pragma once |
13 | | |
14 | | # include <openssl/macros.h> |
15 | | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
16 | | # define HEADER_PEM_H |
17 | | # endif |
18 | | |
19 | | # include <openssl/e_os2.h> |
20 | | # include <openssl/bio.h> |
21 | | # include <openssl/safestack.h> |
22 | | # include <openssl/evp.h> |
23 | | # include <openssl/x509.h> |
24 | | # include <openssl/pemerr.h> |
25 | | |
26 | | #ifdef __cplusplus |
27 | | extern "C" { |
28 | | #endif |
29 | | |
30 | 0 | # define PEM_BUFSIZE 1024 |
31 | | |
32 | 0 | # define PEM_STRING_X509_OLD "X509 CERTIFICATE" |
33 | 0 | # define PEM_STRING_X509 "CERTIFICATE" |
34 | 0 | # define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" |
35 | 0 | # define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" |
36 | 0 | # define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" |
37 | 0 | # define PEM_STRING_X509_CRL "X509 CRL" |
38 | 0 | # define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" |
39 | 0 | # 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 | 0 | # define PEM_STRING_PKCS7 "PKCS7" |
45 | 0 | # define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA" |
46 | 0 | # define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" |
47 | 0 | # define PEM_STRING_PKCS8INF "PRIVATE KEY" |
48 | 0 | # define PEM_STRING_DHPARAMS "DH PARAMETERS" |
49 | 0 | # 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 | 0 | # define PEM_STRING_PARAMETERS "PARAMETERS" |
56 | 0 | # define PEM_STRING_CMS "CMS" |
57 | | |
58 | 0 | # define PEM_TYPE_ENCRYPTED 10 |
59 | 0 | # define PEM_TYPE_MIC_ONLY 20 |
60 | 0 | # define PEM_TYPE_MIC_CLEAR 30 |
61 | | # define PEM_TYPE_CLEAR 40 |
62 | | |
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(...) |
67 | | */ |
68 | | |
69 | | # define PEM_write_fnsig(name, type, OUTTYPE, writename) \ |
70 | | int PEM_##writename##_##name(OUTTYPE *out, const type *x) |
71 | | # define PEM_write_cb_fnsig(name, type, OUTTYPE, writename) \ |
72 | | int PEM_##writename##_##name(OUTTYPE *out, const type *x, \ |
73 | | const EVP_CIPHER *enc, \ |
74 | | const unsigned char *kstr, int klen, \ |
75 | | pem_password_cb *cb, void *u) |
76 | | |
77 | | # ifdef OPENSSL_NO_STDIO |
78 | | |
79 | | # define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/ |
80 | | # define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/ |
81 | | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
82 | | # define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/ |
83 | | # endif |
84 | | # define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/ |
85 | | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
86 | | # define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/ |
87 | | # endif |
88 | | # else |
89 | | |
90 | | # define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ |
91 | | type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u) \ |
92 | 0 | { \ |
93 | 0 | return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str, fp, \ |
94 | 0 | (void **)x, cb, u); \ |
95 | 0 | } Unexecuted instantiation: PEM_read_CMS Unexecuted instantiation: PEM_read_X509_REQ Unexecuted instantiation: PEM_read_X509_CRL Unexecuted instantiation: PEM_read_X509_PUBKEY Unexecuted instantiation: PEM_read_PKCS7 Unexecuted instantiation: PEM_read_NETSCAPE_CERT_SEQUENCE Unexecuted instantiation: PEM_read_RSAPublicKey Unexecuted instantiation: PEM_read_RSA_PUBKEY Unexecuted instantiation: PEM_read_DSA_PUBKEY Unexecuted instantiation: PEM_read_DSAparams Unexecuted instantiation: PEM_read_ECPKParameters Unexecuted instantiation: PEM_read_EC_PUBKEY Unexecuted instantiation: PEM_read_PUBKEY Unexecuted instantiation: PEM_read_PKCS8 Unexecuted instantiation: PEM_read_PKCS8_PRIV_KEY_INFO |
96 | | |
97 | | # define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ |
98 | | PEM_write_fnsig(name, type, FILE, write) \ |
99 | 0 | { \ |
100 | 0 | return PEM_ASN1_write((i2d_of_void *)i2d_##asn1, str, out, \ |
101 | 0 | x, NULL, NULL, 0, NULL, NULL); \ |
102 | 0 | } Unexecuted instantiation: PEM_write_CMS Unexecuted instantiation: PEM_write_X509_REQ Unexecuted instantiation: PEM_write_X509_REQ_NEW Unexecuted instantiation: PEM_write_X509_CRL Unexecuted instantiation: PEM_write_X509_PUBKEY Unexecuted instantiation: PEM_write_PKCS7 Unexecuted instantiation: PEM_write_NETSCAPE_CERT_SEQUENCE Unexecuted instantiation: PEM_write_RSAPublicKey Unexecuted instantiation: PEM_write_RSA_PUBKEY Unexecuted instantiation: PEM_write_DSA_PUBKEY Unexecuted instantiation: PEM_write_DSAparams Unexecuted instantiation: PEM_write_ECPKParameters Unexecuted instantiation: PEM_write_EC_PUBKEY Unexecuted instantiation: PEM_write_DHparams Unexecuted instantiation: PEM_write_DHxparams Unexecuted instantiation: PEM_write_PKCS8 Unexecuted instantiation: PEM_write_PKCS8_PRIV_KEY_INFO |
103 | | |
104 | | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
105 | | # define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ |
106 | | IMPLEMENT_PEM_write_fp(name, type, str, asn1) |
107 | | # endif |
108 | | |
109 | | # define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ |
110 | | PEM_write_cb_fnsig(name, type, FILE, write) \ |
111 | 0 | { \ |
112 | 0 | return PEM_ASN1_write((i2d_of_void *)i2d_##asn1, str, out, \ |
113 | 0 | x, enc, kstr, klen, cb, u); \ |
114 | 0 | } Unexecuted instantiation: PEM_write_RSAPrivateKey Unexecuted instantiation: PEM_write_DSAPrivateKey Unexecuted instantiation: PEM_write_ECPrivateKey |
115 | | |
116 | | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
117 | | # define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ |
118 | | IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) |
119 | | # endif |
120 | | # endif |
121 | | |
122 | | # define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ |
123 | | type *PEM_read_bio_##name(BIO *bp, type **x, \ |
124 | | pem_password_cb *cb, void *u) \ |
125 | 0 | { \ |
126 | 0 | return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str, bp, \ |
127 | 0 | (void **)x, cb, u); \ |
128 | 0 | } Unexecuted instantiation: PEM_read_bio_CMS Unexecuted instantiation: PEM_read_bio_X509_REQ Unexecuted instantiation: PEM_read_bio_X509_CRL Unexecuted instantiation: PEM_read_bio_X509_PUBKEY Unexecuted instantiation: PEM_read_bio_PKCS7 Unexecuted instantiation: PEM_read_bio_NETSCAPE_CERT_SEQUENCE Unexecuted instantiation: PEM_read_bio_RSAPublicKey Unexecuted instantiation: PEM_read_bio_RSA_PUBKEY Unexecuted instantiation: PEM_read_bio_DSA_PUBKEY Unexecuted instantiation: PEM_read_bio_DSAparams Unexecuted instantiation: PEM_read_bio_ECPKParameters Unexecuted instantiation: PEM_read_bio_EC_PUBKEY Unexecuted instantiation: PEM_read_bio_PUBKEY Unexecuted instantiation: PEM_read_bio_PKCS8 Unexecuted instantiation: PEM_read_bio_PKCS8_PRIV_KEY_INFO |
129 | | |
130 | | # define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ |
131 | | PEM_write_fnsig(name, type, BIO, write_bio) \ |
132 | 0 | { \ |
133 | 0 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1, str, out, \ |
134 | 0 | x, NULL,NULL,0,NULL,NULL); \ |
135 | 0 | } Unexecuted instantiation: PEM_write_bio_CMS Unexecuted instantiation: PEM_write_bio_X509_REQ Unexecuted instantiation: PEM_write_bio_X509_REQ_NEW Unexecuted instantiation: PEM_write_bio_X509_CRL Unexecuted instantiation: PEM_write_bio_X509_PUBKEY Unexecuted instantiation: PEM_write_bio_PKCS7 Unexecuted instantiation: PEM_write_bio_NETSCAPE_CERT_SEQUENCE Unexecuted instantiation: PEM_write_bio_RSAPublicKey Unexecuted instantiation: PEM_write_bio_RSA_PUBKEY Unexecuted instantiation: PEM_write_bio_DSA_PUBKEY Unexecuted instantiation: PEM_write_bio_DSAparams Unexecuted instantiation: PEM_write_bio_ECPKParameters Unexecuted instantiation: PEM_write_bio_EC_PUBKEY Unexecuted instantiation: PEM_write_bio_DHparams Unexecuted instantiation: PEM_write_bio_DHxparams Unexecuted instantiation: PEM_write_bio_PKCS8 Unexecuted instantiation: PEM_write_bio_PKCS8_PRIV_KEY_INFO |
136 | | |
137 | | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
138 | | # define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ |
139 | | IMPLEMENT_PEM_write_bio(name, type, str, asn1) |
140 | | # endif |
141 | | |
142 | | # define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ |
143 | | PEM_write_cb_fnsig(name, type, BIO, write_bio) \ |
144 | 0 | { \ |
145 | 0 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1, str, out, \ |
146 | 0 | x, enc, kstr, klen, cb, u); \ |
147 | 0 | } Unexecuted instantiation: PEM_write_bio_RSAPrivateKey Unexecuted instantiation: PEM_write_bio_DSAPrivateKey Unexecuted instantiation: PEM_write_bio_ECPrivateKey |
148 | | |
149 | | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
150 | | # define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ |
151 | | IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) |
152 | | # endif |
153 | | |
154 | | # define IMPLEMENT_PEM_write(name, type, str, asn1) \ |
155 | | IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ |
156 | | IMPLEMENT_PEM_write_fp(name, type, str, asn1) |
157 | | |
158 | | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
159 | | # define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ |
160 | | IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ |
161 | | IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) |
162 | | # endif |
163 | | |
164 | | # define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ |
165 | | IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ |
166 | | IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) |
167 | | |
168 | | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
169 | | # define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ |
170 | | IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ |
171 | | IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) |
172 | | # endif |
173 | | |
174 | | # define IMPLEMENT_PEM_read(name, type, str, asn1) \ |
175 | | IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ |
176 | | IMPLEMENT_PEM_read_fp(name, type, str, asn1) |
177 | | |
178 | | # define IMPLEMENT_PEM_rw(name, type, str, asn1) \ |
179 | | IMPLEMENT_PEM_read(name, type, str, asn1) \ |
180 | | IMPLEMENT_PEM_write(name, type, str, asn1) |
181 | | |
182 | | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
183 | | # define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ |
184 | | IMPLEMENT_PEM_read(name, type, str, asn1) \ |
185 | | IMPLEMENT_PEM_write_const(name, type, str, asn1) |
186 | | # endif |
187 | | |
188 | | # define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ |
189 | | IMPLEMENT_PEM_read(name, type, str, asn1) \ |
190 | | IMPLEMENT_PEM_write_cb(name, type, str, asn1) |
191 | | |
192 | | /* These are the same except they are for the declarations */ |
193 | | |
194 | | # if defined(OPENSSL_NO_STDIO) |
195 | | |
196 | | # define DECLARE_PEM_read_fp(name, type) /**/ |
197 | | # define DECLARE_PEM_write_fp(name, type) /**/ |
198 | | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
199 | | # define DECLARE_PEM_write_fp_const(name, type) /**/ |
200 | | # endif |
201 | | # define DECLARE_PEM_write_cb_fp(name, type) /**/ |
202 | | # else |
203 | | |
204 | | # define DECLARE_PEM_read_fp(name, type) \ |
205 | | type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u); |
206 | | |
207 | | # define DECLARE_PEM_write_fp(name, type) \ |
208 | | PEM_write_fnsig(name, type, FILE, write); |
209 | | |
210 | | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
211 | | # define DECLARE_PEM_write_fp_const(name, type) \ |
212 | | PEM_write_fnsig(name, type, FILE, write); |
213 | | # endif |
214 | | |
215 | | # define DECLARE_PEM_write_cb_fp(name, type) \ |
216 | | PEM_write_cb_fnsig(name, type, FILE, write); |
217 | | |
218 | | # endif |
219 | | |
220 | | # define DECLARE_PEM_read_bio(name, type) \ |
221 | | type *PEM_read_bio_##name(BIO *bp, type **x, \ |
222 | | pem_password_cb *cb, void *u); |
223 | | |
224 | | # define DECLARE_PEM_write_bio(name, type) \ |
225 | | PEM_write_fnsig(name, type, BIO, write_bio); |
226 | | |
227 | | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
228 | | # define DECLARE_PEM_write_bio_const(name, type) \ |
229 | | PEM_write_fnsig(name, type, BIO, write_bio); |
230 | | # endif |
231 | | |
232 | | # define DECLARE_PEM_write_cb_bio(name, type) \ |
233 | | PEM_write_cb_fnsig(name, type, BIO, write_bio); |
234 | | |
235 | | # define DECLARE_PEM_write(name, type) \ |
236 | | DECLARE_PEM_write_bio(name, type) \ |
237 | | DECLARE_PEM_write_fp(name, type) |
238 | | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
239 | | # define DECLARE_PEM_write_const(name, type) \ |
240 | | DECLARE_PEM_write_bio_const(name, type) \ |
241 | | DECLARE_PEM_write_fp_const(name, type) |
242 | | # endif |
243 | | # define DECLARE_PEM_write_cb(name, type) \ |
244 | | DECLARE_PEM_write_cb_bio(name, type) \ |
245 | | DECLARE_PEM_write_cb_fp(name, type) |
246 | | # define DECLARE_PEM_read(name, type) \ |
247 | | DECLARE_PEM_read_bio(name, type) \ |
248 | | DECLARE_PEM_read_fp(name, type) |
249 | | # define DECLARE_PEM_rw(name, type) \ |
250 | | DECLARE_PEM_read(name, type) \ |
251 | | DECLARE_PEM_write(name, type) |
252 | | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
253 | | # define DECLARE_PEM_rw_const(name, type) \ |
254 | | DECLARE_PEM_read(name, type) \ |
255 | | DECLARE_PEM_write_const(name, type) |
256 | | # endif |
257 | | # define DECLARE_PEM_rw_cb(name, type) \ |
258 | | DECLARE_PEM_read(name, type) \ |
259 | | DECLARE_PEM_write_cb(name, type) |
260 | | |
261 | | int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); |
262 | | int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len, |
263 | | pem_password_cb *callback, void *u); |
264 | | |
265 | | int PEM_read_bio(BIO *bp, char **name, char **header, |
266 | | unsigned char **data, long *len); |
267 | 0 | # define PEM_FLAG_SECURE 0x1 |
268 | 0 | # define PEM_FLAG_EAY_COMPATIBLE 0x2 |
269 | 0 | # define PEM_FLAG_ONLY_B64 0x4 |
270 | | int PEM_read_bio_ex(BIO *bp, char **name, char **header, |
271 | | unsigned char **data, long *len, unsigned int flags); |
272 | | int PEM_bytes_read_bio_secmem(unsigned char **pdata, long *plen, char **pnm, |
273 | | const char *name, BIO *bp, pem_password_cb *cb, |
274 | | void *u); |
275 | | int PEM_write_bio(BIO *bp, const char *name, const char *hdr, |
276 | | const unsigned char *data, long len); |
277 | | int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, |
278 | | const char *name, BIO *bp, pem_password_cb *cb, |
279 | | void *u); |
280 | | void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, |
281 | | pem_password_cb *cb, void *u); |
282 | | int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, |
283 | | const void *x, const EVP_CIPHER *enc, |
284 | | const unsigned char *kstr, int klen, |
285 | | pem_password_cb *cb, void *u); |
286 | | |
287 | | STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, |
288 | | pem_password_cb *cb, void *u); |
289 | | int PEM_X509_INFO_write_bio(BIO *bp, const X509_INFO *xi, EVP_CIPHER *enc, |
290 | | const unsigned char *kstr, int klen, |
291 | | pem_password_cb *cd, void *u); |
292 | | |
293 | | #ifndef OPENSSL_NO_STDIO |
294 | | int PEM_read(FILE *fp, char **name, char **header, |
295 | | unsigned char **data, long *len); |
296 | | int PEM_write(FILE *fp, const char *name, const char *hdr, |
297 | | const unsigned char *data, long len); |
298 | | void *PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, |
299 | | pem_password_cb *cb, void *u); |
300 | | int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, |
301 | | const void *x, const EVP_CIPHER *enc, |
302 | | const unsigned char *kstr, int klen, |
303 | | pem_password_cb *callback, void *u); |
304 | | STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, |
305 | | pem_password_cb *cb, void *u); |
306 | | #endif |
307 | | |
308 | | int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); |
309 | | int PEM_SignUpdate(EVP_MD_CTX *ctx, const unsigned char *d, unsigned int cnt); |
310 | | int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, |
311 | | unsigned int *siglen, EVP_PKEY *pkey); |
312 | | |
313 | | /* The default pem_password_cb that's used internally */ |
314 | | int PEM_def_callback(char *buf, int num, int rwflag, void *userdata); |
315 | | void PEM_proc_type(char *buf, int type); |
316 | | void PEM_dek_info(char *buf, const char *type, int len, const char *str); |
317 | | |
318 | | # include <openssl/symhacks.h> |
319 | | |
320 | | DECLARE_PEM_rw(X509, X509) |
321 | | DECLARE_PEM_rw(X509_AUX, X509) |
322 | | DECLARE_PEM_rw(X509_REQ, X509_REQ) |
323 | | DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) |
324 | | DECLARE_PEM_rw(X509_CRL, X509_CRL) |
325 | | DECLARE_PEM_rw(X509_PUBKEY, X509_PUBKEY) |
326 | | DECLARE_PEM_rw(PKCS7, PKCS7) |
327 | | DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE) |
328 | | DECLARE_PEM_rw(PKCS8, X509_SIG) |
329 | | DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) |
330 | | # ifndef OPENSSL_NO_RSA |
331 | | DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) |
332 | | DECLARE_PEM_rw(RSAPublicKey, RSA) |
333 | | DECLARE_PEM_rw(RSA_PUBKEY, RSA) |
334 | | # endif |
335 | | # ifndef OPENSSL_NO_DSA |
336 | | DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) |
337 | | DECLARE_PEM_rw(DSA_PUBKEY, DSA) |
338 | | DECLARE_PEM_rw(DSAparams, DSA) |
339 | | # endif |
340 | | # ifndef OPENSSL_NO_EC |
341 | | DECLARE_PEM_rw(ECPKParameters, EC_GROUP) |
342 | | DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY) |
343 | | DECLARE_PEM_rw(EC_PUBKEY, EC_KEY) |
344 | | # endif |
345 | | # ifndef OPENSSL_NO_DH |
346 | | DECLARE_PEM_rw(DHparams, DH) |
347 | | DECLARE_PEM_write(DHxparams, DH) |
348 | | # endif |
349 | | DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY) |
350 | | DECLARE_PEM_rw(PUBKEY, EVP_PKEY) |
351 | | |
352 | | int PEM_write_bio_PrivateKey_traditional(BIO *bp, const EVP_PKEY *x, |
353 | | const EVP_CIPHER *enc, |
354 | | const unsigned char *kstr, int klen, |
355 | | pem_password_cb *cb, void *u); |
356 | | |
357 | | /* Why do these take a signed char *kstr? */ |
358 | | int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, const EVP_PKEY *x, int nid, |
359 | | const char *kstr, int klen, |
360 | | pem_password_cb *cb, void *u); |
361 | | int PEM_write_bio_PKCS8PrivateKey(BIO *, const EVP_PKEY *, const EVP_CIPHER *, |
362 | | const char *kstr, int klen, |
363 | | pem_password_cb *cb, void *u); |
364 | | int i2d_PKCS8PrivateKey_bio(BIO *bp, const EVP_PKEY *x, const EVP_CIPHER *enc, |
365 | | const char *kstr, int klen, |
366 | | pem_password_cb *cb, void *u); |
367 | | int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, const EVP_PKEY *x, int nid, |
368 | | const char *kstr, int klen, |
369 | | pem_password_cb *cb, void *u); |
370 | | EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, |
371 | | void *u); |
372 | | |
373 | | # ifndef OPENSSL_NO_STDIO |
374 | | int i2d_PKCS8PrivateKey_fp(FILE *fp, const EVP_PKEY *x, const EVP_CIPHER *enc, |
375 | | const char *kstr, int klen, |
376 | | pem_password_cb *cb, void *u); |
377 | | int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, const EVP_PKEY *x, int nid, |
378 | | const char *kstr, int klen, |
379 | | pem_password_cb *cb, void *u); |
380 | | int PEM_write_PKCS8PrivateKey_nid(FILE *fp, const EVP_PKEY *x, int nid, |
381 | | const char *kstr, int klen, |
382 | | pem_password_cb *cb, void *u); |
383 | | |
384 | | EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, |
385 | | void *u); |
386 | | |
387 | | int PEM_write_PKCS8PrivateKey(FILE *fp, const EVP_PKEY *x, const EVP_CIPHER *enc, |
388 | | const char *kstr, int klen, |
389 | | pem_password_cb *cd, void *u); |
390 | | # endif |
391 | | EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x); |
392 | | int PEM_write_bio_Parameters(BIO *bp, const EVP_PKEY *x); |
393 | | |
394 | | # ifndef OPENSSL_NO_DSA |
395 | | EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length); |
396 | | EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length); |
397 | | EVP_PKEY *b2i_PrivateKey_bio(BIO *in); |
398 | | EVP_PKEY *b2i_PublicKey_bio(BIO *in); |
399 | | int i2b_PrivateKey_bio(BIO *out, const EVP_PKEY *pk); |
400 | | int i2b_PublicKey_bio(BIO *out, const EVP_PKEY *pk); |
401 | | # ifndef OPENSSL_NO_RC4 |
402 | | EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u); |
403 | | int i2b_PVK_bio(BIO *out, const EVP_PKEY *pk, int enclevel, |
404 | | pem_password_cb *cb, void *u); |
405 | | # endif |
406 | | # endif |
407 | | |
408 | | # ifdef __cplusplus |
409 | | } |
410 | | # endif |
411 | | #endif |