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