sl@0
|
1 |
/* crypto/pem/pem.h */
|
sl@0
|
2 |
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
*
|
sl@0
|
5 |
* This package is an SSL implementation written
|
sl@0
|
6 |
* by Eric Young (eay@cryptsoft.com).
|
sl@0
|
7 |
* The implementation was written so as to conform with Netscapes SSL.
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* This library is free for commercial and non-commercial use as long as
|
sl@0
|
10 |
* the following conditions are aheared to. The following conditions
|
sl@0
|
11 |
* apply to all code found in this distribution, be it the RC4, RSA,
|
sl@0
|
12 |
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
sl@0
|
13 |
* included with this distribution is covered by the same copyright terms
|
sl@0
|
14 |
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
sl@0
|
15 |
*
|
sl@0
|
16 |
* Copyright remains Eric Young's, and as such any Copyright notices in
|
sl@0
|
17 |
* the code are not to be removed.
|
sl@0
|
18 |
* If this package is used in a product, Eric Young should be given attribution
|
sl@0
|
19 |
* as the author of the parts of the library used.
|
sl@0
|
20 |
* This can be in the form of a textual message at program startup or
|
sl@0
|
21 |
* in documentation (online or textual) provided with the package.
|
sl@0
|
22 |
*
|
sl@0
|
23 |
* Redistribution and use in source and binary forms, with or without
|
sl@0
|
24 |
* modification, are permitted provided that the following conditions
|
sl@0
|
25 |
* are met:
|
sl@0
|
26 |
* 1. Redistributions of source code must retain the copyright
|
sl@0
|
27 |
* notice, this list of conditions and the following disclaimer.
|
sl@0
|
28 |
* 2. Redistributions in binary form must reproduce the above copyright
|
sl@0
|
29 |
* notice, this list of conditions and the following disclaimer in the
|
sl@0
|
30 |
* documentation and/or other materials provided with the distribution.
|
sl@0
|
31 |
* 3. All advertising materials mentioning features or use of this software
|
sl@0
|
32 |
* must display the following acknowledgement:
|
sl@0
|
33 |
* "This product includes cryptographic software written by
|
sl@0
|
34 |
* Eric Young (eay@cryptsoft.com)"
|
sl@0
|
35 |
* The word 'cryptographic' can be left out if the rouines from the library
|
sl@0
|
36 |
* being used are not cryptographic related :-).
|
sl@0
|
37 |
* 4. If you include any Windows specific code (or a derivative thereof) from
|
sl@0
|
38 |
* the apps directory (application code) you must include an acknowledgement:
|
sl@0
|
39 |
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
sl@0
|
40 |
*
|
sl@0
|
41 |
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
sl@0
|
42 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
sl@0
|
43 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
sl@0
|
44 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
sl@0
|
45 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
sl@0
|
46 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
sl@0
|
47 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
sl@0
|
48 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
sl@0
|
49 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
sl@0
|
50 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
sl@0
|
51 |
* SUCH DAMAGE.
|
sl@0
|
52 |
*
|
sl@0
|
53 |
* The licence and distribution terms for any publically available version or
|
sl@0
|
54 |
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
sl@0
|
55 |
* copied and put under another distribution licence
|
sl@0
|
56 |
* [including the GNU Public Licence.]
|
sl@0
|
57 |
*/
|
sl@0
|
58 |
/*
|
sl@0
|
59 |
© Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
|
sl@0
|
60 |
*/
|
sl@0
|
61 |
|
sl@0
|
62 |
#ifndef HEADER_PEM_H
|
sl@0
|
63 |
#define HEADER_PEM_H
|
sl@0
|
64 |
#ifdef SYMBIAN
|
sl@0
|
65 |
#include <e32def.h>
|
sl@0
|
66 |
#endif
|
sl@0
|
67 |
#include <openssl/e_os2.h>
|
sl@0
|
68 |
#ifndef OPENSSL_NO_BIO
|
sl@0
|
69 |
#include <openssl/bio.h>
|
sl@0
|
70 |
#endif
|
sl@0
|
71 |
#ifndef OPENSSL_NO_STACK
|
sl@0
|
72 |
#include <openssl/stack.h>
|
sl@0
|
73 |
#endif
|
sl@0
|
74 |
#include <openssl/evp.h>
|
sl@0
|
75 |
#include <openssl/x509.h>
|
sl@0
|
76 |
#include <openssl/pem2.h>
|
sl@0
|
77 |
|
sl@0
|
78 |
#ifdef __cplusplus
|
sl@0
|
79 |
extern "C" {
|
sl@0
|
80 |
#endif
|
sl@0
|
81 |
|
sl@0
|
82 |
#define PEM_BUFSIZE 1024
|
sl@0
|
83 |
|
sl@0
|
84 |
#define PEM_OBJ_UNDEF 0
|
sl@0
|
85 |
#define PEM_OBJ_X509 1
|
sl@0
|
86 |
#define PEM_OBJ_X509_REQ 2
|
sl@0
|
87 |
#define PEM_OBJ_CRL 3
|
sl@0
|
88 |
#define PEM_OBJ_SSL_SESSION 4
|
sl@0
|
89 |
#define PEM_OBJ_PRIV_KEY 10
|
sl@0
|
90 |
#define PEM_OBJ_PRIV_RSA 11
|
sl@0
|
91 |
#define PEM_OBJ_PRIV_DSA 12
|
sl@0
|
92 |
#define PEM_OBJ_PRIV_DH 13
|
sl@0
|
93 |
#define PEM_OBJ_PUB_RSA 14
|
sl@0
|
94 |
#define PEM_OBJ_PUB_DSA 15
|
sl@0
|
95 |
#define PEM_OBJ_PUB_DH 16
|
sl@0
|
96 |
#define PEM_OBJ_DHPARAMS 17
|
sl@0
|
97 |
#define PEM_OBJ_DSAPARAMS 18
|
sl@0
|
98 |
#define PEM_OBJ_PRIV_RSA_PUBLIC 19
|
sl@0
|
99 |
#define PEM_OBJ_PRIV_ECDSA 20
|
sl@0
|
100 |
#define PEM_OBJ_PUB_ECDSA 21
|
sl@0
|
101 |
#define PEM_OBJ_ECPARAMETERS 22
|
sl@0
|
102 |
|
sl@0
|
103 |
#define PEM_ERROR 30
|
sl@0
|
104 |
#define PEM_DEK_DES_CBC 40
|
sl@0
|
105 |
#define PEM_DEK_IDEA_CBC 45
|
sl@0
|
106 |
#define PEM_DEK_DES_EDE 50
|
sl@0
|
107 |
#define PEM_DEK_DES_ECB 60
|
sl@0
|
108 |
#define PEM_DEK_RSA 70
|
sl@0
|
109 |
#define PEM_DEK_RSA_MD2 80
|
sl@0
|
110 |
#define PEM_DEK_RSA_MD5 90
|
sl@0
|
111 |
|
sl@0
|
112 |
#define PEM_MD_MD2 NID_md2
|
sl@0
|
113 |
#define PEM_MD_MD5 NID_md5
|
sl@0
|
114 |
#define PEM_MD_SHA NID_sha
|
sl@0
|
115 |
#define PEM_MD_MD2_RSA NID_md2WithRSAEncryption
|
sl@0
|
116 |
#define PEM_MD_MD5_RSA NID_md5WithRSAEncryption
|
sl@0
|
117 |
#define PEM_MD_SHA_RSA NID_sha1WithRSAEncryption
|
sl@0
|
118 |
|
sl@0
|
119 |
#define PEM_STRING_X509_OLD "X509 CERTIFICATE"
|
sl@0
|
120 |
#define PEM_STRING_X509 "CERTIFICATE"
|
sl@0
|
121 |
#define PEM_STRING_X509_PAIR "CERTIFICATE PAIR"
|
sl@0
|
122 |
#define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE"
|
sl@0
|
123 |
#define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST"
|
sl@0
|
124 |
#define PEM_STRING_X509_REQ "CERTIFICATE REQUEST"
|
sl@0
|
125 |
#define PEM_STRING_X509_CRL "X509 CRL"
|
sl@0
|
126 |
#define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY"
|
sl@0
|
127 |
#define PEM_STRING_PUBLIC "PUBLIC KEY"
|
sl@0
|
128 |
#define PEM_STRING_RSA "RSA PRIVATE KEY"
|
sl@0
|
129 |
#define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY"
|
sl@0
|
130 |
#define PEM_STRING_DSA "DSA PRIVATE KEY"
|
sl@0
|
131 |
#define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY"
|
sl@0
|
132 |
#define PEM_STRING_PKCS7 "PKCS7"
|
sl@0
|
133 |
#define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY"
|
sl@0
|
134 |
#define PEM_STRING_PKCS8INF "PRIVATE KEY"
|
sl@0
|
135 |
#define PEM_STRING_DHPARAMS "DH PARAMETERS"
|
sl@0
|
136 |
#define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS"
|
sl@0
|
137 |
#define PEM_STRING_DSAPARAMS "DSA PARAMETERS"
|
sl@0
|
138 |
#define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY"
|
sl@0
|
139 |
#define PEM_STRING_ECPARAMETERS "EC PARAMETERS"
|
sl@0
|
140 |
#define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY"
|
sl@0
|
141 |
|
sl@0
|
142 |
/* Note that this structure is initialised by PEM_SealInit and cleaned up
|
sl@0
|
143 |
by PEM_SealFinal (at least for now) */
|
sl@0
|
144 |
typedef struct PEM_Encode_Seal_st
|
sl@0
|
145 |
{
|
sl@0
|
146 |
EVP_ENCODE_CTX encode;
|
sl@0
|
147 |
EVP_MD_CTX md;
|
sl@0
|
148 |
EVP_CIPHER_CTX cipher;
|
sl@0
|
149 |
} PEM_ENCODE_SEAL_CTX;
|
sl@0
|
150 |
|
sl@0
|
151 |
/* enc_type is one off */
|
sl@0
|
152 |
#define PEM_TYPE_ENCRYPTED 10
|
sl@0
|
153 |
#define PEM_TYPE_MIC_ONLY 20
|
sl@0
|
154 |
#define PEM_TYPE_MIC_CLEAR 30
|
sl@0
|
155 |
#define PEM_TYPE_CLEAR 40
|
sl@0
|
156 |
|
sl@0
|
157 |
typedef struct pem_recip_st
|
sl@0
|
158 |
{
|
sl@0
|
159 |
char *name;
|
sl@0
|
160 |
X509_NAME *dn;
|
sl@0
|
161 |
|
sl@0
|
162 |
int cipher;
|
sl@0
|
163 |
int key_enc;
|
sl@0
|
164 |
/* char iv[8]; unused and wrong size */
|
sl@0
|
165 |
} PEM_USER;
|
sl@0
|
166 |
|
sl@0
|
167 |
typedef struct pem_ctx_st
|
sl@0
|
168 |
{
|
sl@0
|
169 |
int type; /* what type of object */
|
sl@0
|
170 |
|
sl@0
|
171 |
struct {
|
sl@0
|
172 |
int version;
|
sl@0
|
173 |
int mode;
|
sl@0
|
174 |
} proc_type;
|
sl@0
|
175 |
|
sl@0
|
176 |
char *domain;
|
sl@0
|
177 |
|
sl@0
|
178 |
struct {
|
sl@0
|
179 |
int cipher;
|
sl@0
|
180 |
/* unused, and wrong size
|
sl@0
|
181 |
unsigned char iv[8]; */
|
sl@0
|
182 |
} DEK_info;
|
sl@0
|
183 |
|
sl@0
|
184 |
PEM_USER *originator;
|
sl@0
|
185 |
|
sl@0
|
186 |
int num_recipient;
|
sl@0
|
187 |
PEM_USER **recipient;
|
sl@0
|
188 |
|
sl@0
|
189 |
#ifndef OPENSSL_NO_STACK
|
sl@0
|
190 |
STACK *x509_chain; /* certificate chain */
|
sl@0
|
191 |
#else
|
sl@0
|
192 |
char *x509_chain; /* certificate chain */
|
sl@0
|
193 |
#endif
|
sl@0
|
194 |
EVP_MD *md; /* signature type */
|
sl@0
|
195 |
|
sl@0
|
196 |
int md_enc; /* is the md encrypted or not? */
|
sl@0
|
197 |
int md_len; /* length of md_data */
|
sl@0
|
198 |
char *md_data; /* message digest, could be pkey encrypted */
|
sl@0
|
199 |
|
sl@0
|
200 |
EVP_CIPHER *dec; /* date encryption cipher */
|
sl@0
|
201 |
int key_len; /* key length */
|
sl@0
|
202 |
unsigned char *key; /* key */
|
sl@0
|
203 |
/* unused, and wrong size
|
sl@0
|
204 |
unsigned char iv[8]; */
|
sl@0
|
205 |
|
sl@0
|
206 |
|
sl@0
|
207 |
int data_enc; /* is the data encrypted */
|
sl@0
|
208 |
int data_len;
|
sl@0
|
209 |
unsigned char *data;
|
sl@0
|
210 |
} PEM_CTX;
|
sl@0
|
211 |
|
sl@0
|
212 |
/* These macros make the PEM_read/PEM_write functions easier to maintain and
|
sl@0
|
213 |
* write. Now they are all implemented with either:
|
sl@0
|
214 |
* IMPLEMENT_PEM_rw(...) or IMPLEMENT_PEM_rw_cb(...)
|
sl@0
|
215 |
*/
|
sl@0
|
216 |
|
sl@0
|
217 |
#ifdef OPENSSL_NO_FP_API
|
sl@0
|
218 |
|
sl@0
|
219 |
#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/
|
sl@0
|
220 |
#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/
|
sl@0
|
221 |
#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/
|
sl@0
|
222 |
|
sl@0
|
223 |
#else
|
sl@0
|
224 |
|
sl@0
|
225 |
#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \
|
sl@0
|
226 |
EXPORT_C type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\
|
sl@0
|
227 |
{ \
|
sl@0
|
228 |
return (type*)PEM_ASN1_read(CHECKED_D2I_OF(type, d2i_##asn1), \
|
sl@0
|
229 |
str, fp, \
|
sl@0
|
230 |
CHECKED_PPTR_OF(type, x), \
|
sl@0
|
231 |
cb, u); \
|
sl@0
|
232 |
}
|
sl@0
|
233 |
|
sl@0
|
234 |
#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \
|
sl@0
|
235 |
EXPORT_C int PEM_write_##name(FILE *fp, type *x) \
|
sl@0
|
236 |
{ \
|
sl@0
|
237 |
return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \
|
sl@0
|
238 |
str, fp, \
|
sl@0
|
239 |
CHECKED_PTR_OF(type, x), \
|
sl@0
|
240 |
NULL, NULL, 0, NULL, NULL); \
|
sl@0
|
241 |
}
|
sl@0
|
242 |
|
sl@0
|
243 |
#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \
|
sl@0
|
244 |
EXPORT_C int PEM_write_##name(FILE *fp, const type *x) \
|
sl@0
|
245 |
{ \
|
sl@0
|
246 |
return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \
|
sl@0
|
247 |
str, fp, \
|
sl@0
|
248 |
CHECKED_PTR_OF(const type, x), \
|
sl@0
|
249 |
NULL, NULL, 0, NULL, NULL); \
|
sl@0
|
250 |
}
|
sl@0
|
251 |
|
sl@0
|
252 |
#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \
|
sl@0
|
253 |
EXPORT_C int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
|
sl@0
|
254 |
unsigned char *kstr, int klen, pem_password_cb *cb, \
|
sl@0
|
255 |
void *u) \
|
sl@0
|
256 |
{ \
|
sl@0
|
257 |
return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \
|
sl@0
|
258 |
str, fp, \
|
sl@0
|
259 |
CHECKED_PTR_OF(type, x), \
|
sl@0
|
260 |
enc, kstr, klen, cb, u); \
|
sl@0
|
261 |
}
|
sl@0
|
262 |
|
sl@0
|
263 |
#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \
|
sl@0
|
264 |
EXPORT_C int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
|
sl@0
|
265 |
unsigned char *kstr, int klen, pem_password_cb *cb, \
|
sl@0
|
266 |
void *u) \
|
sl@0
|
267 |
{ \
|
sl@0
|
268 |
return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \
|
sl@0
|
269 |
str, fp, \
|
sl@0
|
270 |
CHECKED_PTR_OF(const type, x), \
|
sl@0
|
271 |
enc, kstr, klen, cb, u); \
|
sl@0
|
272 |
}
|
sl@0
|
273 |
|
sl@0
|
274 |
#endif
|
sl@0
|
275 |
|
sl@0
|
276 |
#define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
|
sl@0
|
277 |
EXPORT_C type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\
|
sl@0
|
278 |
{ \
|
sl@0
|
279 |
return (type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i_##asn1), \
|
sl@0
|
280 |
str, bp, \
|
sl@0
|
281 |
CHECKED_PPTR_OF(type, x), \
|
sl@0
|
282 |
cb, u); \
|
sl@0
|
283 |
}
|
sl@0
|
284 |
|
sl@0
|
285 |
#define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
|
sl@0
|
286 |
EXPORT_C int PEM_write_bio_##name(BIO *bp, type *x) \
|
sl@0
|
287 |
{ \
|
sl@0
|
288 |
return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \
|
sl@0
|
289 |
str, bp, \
|
sl@0
|
290 |
CHECKED_PTR_OF(type, x), \
|
sl@0
|
291 |
NULL, NULL, 0, NULL, NULL); \
|
sl@0
|
292 |
}
|
sl@0
|
293 |
|
sl@0
|
294 |
#define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
|
sl@0
|
295 |
EXPORT_C int PEM_write_bio_##name(BIO *bp, const type *x) \
|
sl@0
|
296 |
{ \
|
sl@0
|
297 |
return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \
|
sl@0
|
298 |
str, bp, \
|
sl@0
|
299 |
CHECKED_PTR_OF(const type, x), \
|
sl@0
|
300 |
NULL, NULL, 0, NULL, NULL); \
|
sl@0
|
301 |
}
|
sl@0
|
302 |
|
sl@0
|
303 |
#define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
|
sl@0
|
304 |
EXPORT_C int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
|
sl@0
|
305 |
unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
|
sl@0
|
306 |
{ \
|
sl@0
|
307 |
return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \
|
sl@0
|
308 |
str, bp, \
|
sl@0
|
309 |
CHECKED_PTR_OF(type, x), \
|
sl@0
|
310 |
enc, kstr, klen, cb, u); \
|
sl@0
|
311 |
}
|
sl@0
|
312 |
|
sl@0
|
313 |
#define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
|
sl@0
|
314 |
EXPORT_C int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
|
sl@0
|
315 |
unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
|
sl@0
|
316 |
{ \
|
sl@0
|
317 |
return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \
|
sl@0
|
318 |
str, bp, \
|
sl@0
|
319 |
CHECKED_PTR_OF(const type, x), \
|
sl@0
|
320 |
enc, kstr, klen, cb, u); \
|
sl@0
|
321 |
}
|
sl@0
|
322 |
|
sl@0
|
323 |
#define IMPLEMENT_PEM_write(name, type, str, asn1) \
|
sl@0
|
324 |
IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
|
sl@0
|
325 |
IMPLEMENT_PEM_write_fp(name, type, str, asn1)
|
sl@0
|
326 |
|
sl@0
|
327 |
#define IMPLEMENT_PEM_write_const(name, type, str, asn1) \
|
sl@0
|
328 |
IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
|
sl@0
|
329 |
IMPLEMENT_PEM_write_fp_const(name, type, str, asn1)
|
sl@0
|
330 |
|
sl@0
|
331 |
#define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \
|
sl@0
|
332 |
IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
|
sl@0
|
333 |
IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1)
|
sl@0
|
334 |
|
sl@0
|
335 |
#define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \
|
sl@0
|
336 |
IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
|
sl@0
|
337 |
IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1)
|
sl@0
|
338 |
|
sl@0
|
339 |
#define IMPLEMENT_PEM_read(name, type, str, asn1) \
|
sl@0
|
340 |
IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
|
sl@0
|
341 |
IMPLEMENT_PEM_read_fp(name, type, str, asn1)
|
sl@0
|
342 |
|
sl@0
|
343 |
#define IMPLEMENT_PEM_rw(name, type, str, asn1) \
|
sl@0
|
344 |
IMPLEMENT_PEM_read(name, type, str, asn1) \
|
sl@0
|
345 |
IMPLEMENT_PEM_write(name, type, str, asn1)
|
sl@0
|
346 |
|
sl@0
|
347 |
#define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \
|
sl@0
|
348 |
IMPLEMENT_PEM_read(name, type, str, asn1) \
|
sl@0
|
349 |
IMPLEMENT_PEM_write_const(name, type, str, asn1)
|
sl@0
|
350 |
|
sl@0
|
351 |
#define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \
|
sl@0
|
352 |
IMPLEMENT_PEM_read(name, type, str, asn1) \
|
sl@0
|
353 |
IMPLEMENT_PEM_write_cb(name, type, str, asn1)
|
sl@0
|
354 |
|
sl@0
|
355 |
/* These are the same except they are for the declarations */
|
sl@0
|
356 |
|
sl@0
|
357 |
#if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_NO_FP_API)
|
sl@0
|
358 |
|
sl@0
|
359 |
#define DECLARE_PEM_read_fp(name, type) /**/
|
sl@0
|
360 |
#define DECLARE_PEM_write_fp(name, type) /**/
|
sl@0
|
361 |
#define DECLARE_PEM_write_cb_fp(name, type) /**/
|
sl@0
|
362 |
|
sl@0
|
363 |
#else
|
sl@0
|
364 |
|
sl@0
|
365 |
#define DECLARE_PEM_read_fp(name, type) \
|
sl@0
|
366 |
IMPORT_C type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u);
|
sl@0
|
367 |
|
sl@0
|
368 |
#define DECLARE_PEM_write_fp(name, type) \
|
sl@0
|
369 |
IMPORT_C int PEM_write_##name(FILE *fp, type *x);
|
sl@0
|
370 |
|
sl@0
|
371 |
#define DECLARE_PEM_write_fp_const(name, type) \
|
sl@0
|
372 |
IMPORT_C int PEM_write_##name(FILE *fp, const type *x);
|
sl@0
|
373 |
|
sl@0
|
374 |
#define DECLARE_PEM_write_cb_fp(name, type) \
|
sl@0
|
375 |
IMPORT_C int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
|
sl@0
|
376 |
unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
|
sl@0
|
377 |
|
sl@0
|
378 |
#endif
|
sl@0
|
379 |
|
sl@0
|
380 |
#ifndef OPENSSL_NO_BIO
|
sl@0
|
381 |
#define DECLARE_PEM_read_bio(name, type) \
|
sl@0
|
382 |
IMPORT_C type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u);
|
sl@0
|
383 |
|
sl@0
|
384 |
#define DECLARE_PEM_write_bio(name, type) \
|
sl@0
|
385 |
IMPORT_C int PEM_write_bio_##name(BIO *bp, type *x);
|
sl@0
|
386 |
|
sl@0
|
387 |
#define DECLARE_PEM_write_bio_const(name, type) \
|
sl@0
|
388 |
IMPORT_C int PEM_write_bio_##name(BIO *bp, const type *x);
|
sl@0
|
389 |
|
sl@0
|
390 |
#define DECLARE_PEM_write_cb_bio(name, type) \
|
sl@0
|
391 |
IMPORT_C int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
|
sl@0
|
392 |
unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
|
sl@0
|
393 |
|
sl@0
|
394 |
#else
|
sl@0
|
395 |
|
sl@0
|
396 |
#define DECLARE_PEM_read_bio(name, type) /**/
|
sl@0
|
397 |
#define DECLARE_PEM_write_bio(name, type) /**/
|
sl@0
|
398 |
#define DECLARE_PEM_write_cb_bio(name, type) /**/
|
sl@0
|
399 |
|
sl@0
|
400 |
#endif
|
sl@0
|
401 |
|
sl@0
|
402 |
#define DECLARE_PEM_write(name, type) \
|
sl@0
|
403 |
DECLARE_PEM_write_bio(name, type) \
|
sl@0
|
404 |
DECLARE_PEM_write_fp(name, type)
|
sl@0
|
405 |
|
sl@0
|
406 |
#define DECLARE_PEM_write_const(name, type) \
|
sl@0
|
407 |
DECLARE_PEM_write_bio_const(name, type) \
|
sl@0
|
408 |
DECLARE_PEM_write_fp_const(name, type)
|
sl@0
|
409 |
|
sl@0
|
410 |
#define DECLARE_PEM_write_cb(name, type) \
|
sl@0
|
411 |
DECLARE_PEM_write_cb_bio(name, type) \
|
sl@0
|
412 |
DECLARE_PEM_write_cb_fp(name, type)
|
sl@0
|
413 |
|
sl@0
|
414 |
#define DECLARE_PEM_read(name, type) \
|
sl@0
|
415 |
DECLARE_PEM_read_bio(name, type) \
|
sl@0
|
416 |
DECLARE_PEM_read_fp(name, type)
|
sl@0
|
417 |
|
sl@0
|
418 |
#define DECLARE_PEM_rw(name, type) \
|
sl@0
|
419 |
DECLARE_PEM_read(name, type) \
|
sl@0
|
420 |
DECLARE_PEM_write(name, type)
|
sl@0
|
421 |
|
sl@0
|
422 |
#define DECLARE_PEM_rw_const(name, type) \
|
sl@0
|
423 |
DECLARE_PEM_read(name, type) \
|
sl@0
|
424 |
DECLARE_PEM_write_const(name, type)
|
sl@0
|
425 |
|
sl@0
|
426 |
#define DECLARE_PEM_rw_cb(name, type) \
|
sl@0
|
427 |
DECLARE_PEM_read(name, type) \
|
sl@0
|
428 |
DECLARE_PEM_write_cb(name, type)
|
sl@0
|
429 |
|
sl@0
|
430 |
#ifdef SSLEAY_MACROS
|
sl@0
|
431 |
|
sl@0
|
432 |
#define PEM_write_SSL_SESSION(fp,x) \
|
sl@0
|
433 |
PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \
|
sl@0
|
434 |
PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL)
|
sl@0
|
435 |
#define PEM_write_X509(fp,x) \
|
sl@0
|
436 |
PEM_ASN1_write((int (*)())i2d_X509,PEM_STRING_X509,fp, \
|
sl@0
|
437 |
(char *)x, NULL,NULL,0,NULL,NULL)
|
sl@0
|
438 |
#define PEM_write_X509_REQ(fp,x) PEM_ASN1_write( \
|
sl@0
|
439 |
(int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,fp,(char *)x, \
|
sl@0
|
440 |
NULL,NULL,0,NULL,NULL)
|
sl@0
|
441 |
#define PEM_write_X509_CRL(fp,x) \
|
sl@0
|
442 |
PEM_ASN1_write((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL, \
|
sl@0
|
443 |
fp,(char *)x, NULL,NULL,0,NULL,NULL)
|
sl@0
|
444 |
#define PEM_write_RSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \
|
sl@0
|
445 |
PEM_ASN1_write((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,fp,\
|
sl@0
|
446 |
(char *)x,enc,kstr,klen,cb,u)
|
sl@0
|
447 |
#define PEM_write_RSAPublicKey(fp,x) \
|
sl@0
|
448 |
PEM_ASN1_write((int (*)())i2d_RSAPublicKey,\
|
sl@0
|
449 |
PEM_STRING_RSA_PUBLIC,fp,(char *)x,NULL,NULL,0,NULL,NULL)
|
sl@0
|
450 |
#define PEM_write_DSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \
|
sl@0
|
451 |
PEM_ASN1_write((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,fp,\
|
sl@0
|
452 |
(char *)x,enc,kstr,klen,cb,u)
|
sl@0
|
453 |
#define PEM_write_PrivateKey(bp,x,enc,kstr,klen,cb,u) \
|
sl@0
|
454 |
PEM_ASN1_write((int (*)())i2d_PrivateKey,\
|
sl@0
|
455 |
(((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\
|
sl@0
|
456 |
bp,(char *)x,enc,kstr,klen,cb,u)
|
sl@0
|
457 |
#define PEM_write_PKCS7(fp,x) \
|
sl@0
|
458 |
PEM_ASN1_write((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,fp, \
|
sl@0
|
459 |
(char *)x, NULL,NULL,0,NULL,NULL)
|
sl@0
|
460 |
#define PEM_write_DHparams(fp,x) \
|
sl@0
|
461 |
PEM_ASN1_write((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,fp,\
|
sl@0
|
462 |
(char *)x,NULL,NULL,0,NULL,NULL)
|
sl@0
|
463 |
|
sl@0
|
464 |
#define PEM_write_NETSCAPE_CERT_SEQUENCE(fp,x) \
|
sl@0
|
465 |
PEM_ASN1_write((int (*)())i2d_NETSCAPE_CERT_SEQUENCE, \
|
sl@0
|
466 |
PEM_STRING_X509,fp, \
|
sl@0
|
467 |
(char *)x, NULL,NULL,0,NULL,NULL)
|
sl@0
|
468 |
|
sl@0
|
469 |
#define PEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \
|
sl@0
|
470 |
(char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u)
|
sl@0
|
471 |
#define PEM_read_X509(fp,x,cb,u) (X509 *)PEM_ASN1_read( \
|
sl@0
|
472 |
(char *(*)())d2i_X509,PEM_STRING_X509,fp,(char **)x,cb,u)
|
sl@0
|
473 |
#define PEM_read_X509_REQ(fp,x,cb,u) (X509_REQ *)PEM_ASN1_read( \
|
sl@0
|
474 |
(char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,fp,(char **)x,cb,u)
|
sl@0
|
475 |
#define PEM_read_X509_CRL(fp,x,cb,u) (X509_CRL *)PEM_ASN1_read( \
|
sl@0
|
476 |
(char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,fp,(char **)x,cb,u)
|
sl@0
|
477 |
#define PEM_read_RSAPrivateKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \
|
sl@0
|
478 |
(char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,fp,(char **)x,cb,u)
|
sl@0
|
479 |
#define PEM_read_RSAPublicKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \
|
sl@0
|
480 |
(char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,fp,(char **)x,cb,u)
|
sl@0
|
481 |
#define PEM_read_DSAPrivateKey(fp,x,cb,u) (DSA *)PEM_ASN1_read( \
|
sl@0
|
482 |
(char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,fp,(char **)x,cb,u)
|
sl@0
|
483 |
#define PEM_read_PrivateKey(fp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read( \
|
sl@0
|
484 |
(char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,fp,(char **)x,cb,u)
|
sl@0
|
485 |
#define PEM_read_PKCS7(fp,x,cb,u) (PKCS7 *)PEM_ASN1_read( \
|
sl@0
|
486 |
(char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,fp,(char **)x,cb,u)
|
sl@0
|
487 |
#define PEM_read_DHparams(fp,x,cb,u) (DH *)PEM_ASN1_read( \
|
sl@0
|
488 |
(char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,fp,(char **)x,cb,u)
|
sl@0
|
489 |
|
sl@0
|
490 |
#define PEM_read_NETSCAPE_CERT_SEQUENCE(fp,x,cb,u) \
|
sl@0
|
491 |
(NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read( \
|
sl@0
|
492 |
(char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,fp,\
|
sl@0
|
493 |
(char **)x,cb,u)
|
sl@0
|
494 |
|
sl@0
|
495 |
#define PEM_write_bio_X509(bp,x) \
|
sl@0
|
496 |
PEM_ASN1_write_bio((int (*)())i2d_X509,PEM_STRING_X509,bp, \
|
sl@0
|
497 |
(char *)x, NULL,NULL,0,NULL,NULL)
|
sl@0
|
498 |
#define PEM_write_bio_X509_REQ(bp,x) PEM_ASN1_write_bio( \
|
sl@0
|
499 |
(int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,bp,(char *)x, \
|
sl@0
|
500 |
NULL,NULL,0,NULL,NULL)
|
sl@0
|
501 |
#define PEM_write_bio_X509_CRL(bp,x) \
|
sl@0
|
502 |
PEM_ASN1_write_bio((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL,\
|
sl@0
|
503 |
bp,(char *)x, NULL,NULL,0,NULL,NULL)
|
sl@0
|
504 |
#define PEM_write_bio_RSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \
|
sl@0
|
505 |
PEM_ASN1_write_bio((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,\
|
sl@0
|
506 |
bp,(char *)x,enc,kstr,klen,cb,u)
|
sl@0
|
507 |
#define PEM_write_bio_RSAPublicKey(bp,x) \
|
sl@0
|
508 |
PEM_ASN1_write_bio((int (*)())i2d_RSAPublicKey, \
|
sl@0
|
509 |
PEM_STRING_RSA_PUBLIC,\
|
sl@0
|
510 |
bp,(char *)x,NULL,NULL,0,NULL,NULL)
|
sl@0
|
511 |
#define PEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \
|
sl@0
|
512 |
PEM_ASN1_write_bio((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,\
|
sl@0
|
513 |
bp,(char *)x,enc,kstr,klen,cb,u)
|
sl@0
|
514 |
#define PEM_write_bio_PrivateKey(bp,x,enc,kstr,klen,cb,u) \
|
sl@0
|
515 |
PEM_ASN1_write_bio((int (*)())i2d_PrivateKey,\
|
sl@0
|
516 |
(((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\
|
sl@0
|
517 |
bp,(char *)x,enc,kstr,klen,cb,u)
|
sl@0
|
518 |
#define PEM_write_bio_PKCS7(bp,x) \
|
sl@0
|
519 |
PEM_ASN1_write_bio((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,bp, \
|
sl@0
|
520 |
(char *)x, NULL,NULL,0,NULL,NULL)
|
sl@0
|
521 |
#define PEM_write_bio_DHparams(bp,x) \
|
sl@0
|
522 |
PEM_ASN1_write_bio((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,\
|
sl@0
|
523 |
bp,(char *)x,NULL,NULL,0,NULL,NULL)
|
sl@0
|
524 |
#define PEM_write_bio_DSAparams(bp,x) \
|
sl@0
|
525 |
PEM_ASN1_write_bio((int (*)())i2d_DSAparams, \
|
sl@0
|
526 |
PEM_STRING_DSAPARAMS,bp,(char *)x,NULL,NULL,0,NULL,NULL)
|
sl@0
|
527 |
|
sl@0
|
528 |
#define PEM_write_bio_NETSCAPE_CERT_SEQUENCE(bp,x) \
|
sl@0
|
529 |
PEM_ASN1_write_bio((int (*)())i2d_NETSCAPE_CERT_SEQUENCE, \
|
sl@0
|
530 |
PEM_STRING_X509,bp, \
|
sl@0
|
531 |
(char *)x, NULL,NULL,0,NULL,NULL)
|
sl@0
|
532 |
|
sl@0
|
533 |
#define PEM_read_bio_X509(bp,x,cb,u) (X509 *)PEM_ASN1_read_bio( \
|
sl@0
|
534 |
(char *(*)())d2i_X509,PEM_STRING_X509,bp,(char **)x,cb,u)
|
sl@0
|
535 |
#define PEM_read_bio_X509_REQ(bp,x,cb,u) (X509_REQ *)PEM_ASN1_read_bio( \
|
sl@0
|
536 |
(char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,bp,(char **)x,cb,u)
|
sl@0
|
537 |
#define PEM_read_bio_X509_CRL(bp,x,cb,u) (X509_CRL *)PEM_ASN1_read_bio( \
|
sl@0
|
538 |
(char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,bp,(char **)x,cb,u)
|
sl@0
|
539 |
#define PEM_read_bio_RSAPrivateKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \
|
sl@0
|
540 |
(char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,bp,(char **)x,cb,u)
|
sl@0
|
541 |
#define PEM_read_bio_RSAPublicKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \
|
sl@0
|
542 |
(char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,bp,(char **)x,cb,u)
|
sl@0
|
543 |
#define PEM_read_bio_DSAPrivateKey(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \
|
sl@0
|
544 |
(char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,bp,(char **)x,cb,u)
|
sl@0
|
545 |
#define PEM_read_bio_PrivateKey(bp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read_bio( \
|
sl@0
|
546 |
(char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,bp,(char **)x,cb,u)
|
sl@0
|
547 |
|
sl@0
|
548 |
#define PEM_read_bio_PKCS7(bp,x,cb,u) (PKCS7 *)PEM_ASN1_read_bio( \
|
sl@0
|
549 |
(char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,bp,(char **)x,cb,u)
|
sl@0
|
550 |
#define PEM_read_bio_DHparams(bp,x,cb,u) (DH *)PEM_ASN1_read_bio( \
|
sl@0
|
551 |
(char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,bp,(char **)x,cb,u)
|
sl@0
|
552 |
#define PEM_read_bio_DSAparams(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \
|
sl@0
|
553 |
(char *(*)())d2i_DSAparams,PEM_STRING_DSAPARAMS,bp,(char **)x,cb,u)
|
sl@0
|
554 |
|
sl@0
|
555 |
#define PEM_read_bio_NETSCAPE_CERT_SEQUENCE(bp,x,cb,u) \
|
sl@0
|
556 |
(NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read_bio( \
|
sl@0
|
557 |
(char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,bp,\
|
sl@0
|
558 |
(char **)x,cb,u)
|
sl@0
|
559 |
|
sl@0
|
560 |
#endif
|
sl@0
|
561 |
|
sl@0
|
562 |
#if 1
|
sl@0
|
563 |
/* "userdata": new with OpenSSL 0.9.4 */
|
sl@0
|
564 |
typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata);
|
sl@0
|
565 |
#else
|
sl@0
|
566 |
/* OpenSSL 0.9.3, 0.9.3a */
|
sl@0
|
567 |
typedef int pem_password_cb(char *buf, int size, int rwflag);
|
sl@0
|
568 |
#endif
|
sl@0
|
569 |
|
sl@0
|
570 |
IMPORT_C int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher);
|
sl@0
|
571 |
IMPORT_C int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len,
|
sl@0
|
572 |
pem_password_cb *callback,void *u);
|
sl@0
|
573 |
|
sl@0
|
574 |
#ifndef OPENSSL_NO_BIO
|
sl@0
|
575 |
IMPORT_C int PEM_read_bio(BIO *bp, char **name, char **header,
|
sl@0
|
576 |
unsigned char **data,long *len);
|
sl@0
|
577 |
IMPORT_C int PEM_write_bio(BIO *bp,const char *name,char *hdr,unsigned char *data,
|
sl@0
|
578 |
long len);
|
sl@0
|
579 |
IMPORT_C int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char *name, BIO *bp,
|
sl@0
|
580 |
pem_password_cb *cb, void *u);
|
sl@0
|
581 |
IMPORT_C void * PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp,
|
sl@0
|
582 |
void **x, pem_password_cb *cb, void *u);
|
sl@0
|
583 |
|
sl@0
|
584 |
#define PEM_ASN1_read_bio_of(type,d2i,name,bp,x,cb,u) \
|
sl@0
|
585 |
((type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i), \
|
sl@0
|
586 |
name, bp, \
|
sl@0
|
587 |
CHECKED_PPTR_OF(type, x), \
|
sl@0
|
588 |
cb, u))
|
sl@0
|
589 |
|
sl@0
|
590 |
IMPORT_C int PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp,char *x,
|
sl@0
|
591 |
const EVP_CIPHER *enc,unsigned char *kstr,int klen,
|
sl@0
|
592 |
pem_password_cb *cb, void *u);
|
sl@0
|
593 |
|
sl@0
|
594 |
#define PEM_ASN1_write_bio_of(type,i2d,name,bp,x,enc,kstr,klen,cb,u) \
|
sl@0
|
595 |
(PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d), \
|
sl@0
|
596 |
name, bp, \
|
sl@0
|
597 |
CHECKED_PTR_OF(type, x), \
|
sl@0
|
598 |
enc, kstr, klen, cb, u))
|
sl@0
|
599 |
|
sl@0
|
600 |
IMPORT_C STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);
|
sl@0
|
601 |
IMPORT_C int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc,
|
sl@0
|
602 |
unsigned char *kstr, int klen, pem_password_cb *cd, void *u);
|
sl@0
|
603 |
#endif
|
sl@0
|
604 |
|
sl@0
|
605 |
#ifndef OPENSSL_SYS_WIN16
|
sl@0
|
606 |
IMPORT_C int PEM_read(FILE *fp, char **name, char **header,
|
sl@0
|
607 |
unsigned char **data,long *len);
|
sl@0
|
608 |
IMPORT_C int PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len);
|
sl@0
|
609 |
IMPORT_C void * PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x,
|
sl@0
|
610 |
pem_password_cb *cb, void *u);
|
sl@0
|
611 |
IMPORT_C int PEM_ASN1_write(i2d_of_void *i2d,const char *name,FILE *fp,
|
sl@0
|
612 |
char *x,const EVP_CIPHER *enc,unsigned char *kstr,
|
sl@0
|
613 |
int klen,pem_password_cb *callback, void *u);
|
sl@0
|
614 |
IMPORT_C STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
|
sl@0
|
615 |
pem_password_cb *cb, void *u);
|
sl@0
|
616 |
#endif
|
sl@0
|
617 |
|
sl@0
|
618 |
IMPORT_C int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type,
|
sl@0
|
619 |
EVP_MD *md_type, unsigned char **ek, int *ekl,
|
sl@0
|
620 |
unsigned char *iv, EVP_PKEY **pubk, int npubk);
|
sl@0
|
621 |
IMPORT_C void PEM_SealUpdate(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *out, int *outl,
|
sl@0
|
622 |
unsigned char *in, int inl);
|
sl@0
|
623 |
IMPORT_C int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig,int *sigl,
|
sl@0
|
624 |
unsigned char *out, int *outl, EVP_PKEY *priv);
|
sl@0
|
625 |
|
sl@0
|
626 |
IMPORT_C void PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type);
|
sl@0
|
627 |
IMPORT_C void PEM_SignUpdate(EVP_MD_CTX *ctx,unsigned char *d,unsigned int cnt);
|
sl@0
|
628 |
IMPORT_C int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
|
sl@0
|
629 |
unsigned int *siglen, EVP_PKEY *pkey);
|
sl@0
|
630 |
|
sl@0
|
631 |
IMPORT_C int PEM_def_callback(char *buf, int num, int w, void *key);
|
sl@0
|
632 |
IMPORT_C void PEM_proc_type(char *buf, int type);
|
sl@0
|
633 |
IMPORT_C void PEM_dek_info(char *buf, const char *type, int len, char *str);
|
sl@0
|
634 |
|
sl@0
|
635 |
#ifndef SSLEAY_MACROS
|
sl@0
|
636 |
|
sl@0
|
637 |
#include <openssl/symhacks.h>
|
sl@0
|
638 |
|
sl@0
|
639 |
DECLARE_PEM_rw(X509, X509)
|
sl@0
|
640 |
|
sl@0
|
641 |
DECLARE_PEM_rw(X509_AUX, X509)
|
sl@0
|
642 |
|
sl@0
|
643 |
DECLARE_PEM_rw(X509_CERT_PAIR, X509_CERT_PAIR)
|
sl@0
|
644 |
|
sl@0
|
645 |
DECLARE_PEM_rw(X509_REQ, X509_REQ)
|
sl@0
|
646 |
DECLARE_PEM_write(X509_REQ_NEW, X509_REQ)
|
sl@0
|
647 |
|
sl@0
|
648 |
DECLARE_PEM_rw(X509_CRL, X509_CRL)
|
sl@0
|
649 |
|
sl@0
|
650 |
DECLARE_PEM_rw(PKCS7, PKCS7)
|
sl@0
|
651 |
|
sl@0
|
652 |
DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE)
|
sl@0
|
653 |
|
sl@0
|
654 |
DECLARE_PEM_rw(PKCS8, X509_SIG)
|
sl@0
|
655 |
|
sl@0
|
656 |
DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
|
sl@0
|
657 |
|
sl@0
|
658 |
#ifndef OPENSSL_NO_RSA
|
sl@0
|
659 |
|
sl@0
|
660 |
DECLARE_PEM_rw_cb(RSAPrivateKey, RSA)
|
sl@0
|
661 |
|
sl@0
|
662 |
DECLARE_PEM_rw_const(RSAPublicKey, RSA)
|
sl@0
|
663 |
DECLARE_PEM_rw(RSA_PUBKEY, RSA)
|
sl@0
|
664 |
|
sl@0
|
665 |
#endif
|
sl@0
|
666 |
|
sl@0
|
667 |
#ifndef OPENSSL_NO_DSA
|
sl@0
|
668 |
|
sl@0
|
669 |
DECLARE_PEM_rw_cb(DSAPrivateKey, DSA)
|
sl@0
|
670 |
|
sl@0
|
671 |
DECLARE_PEM_rw(DSA_PUBKEY, DSA)
|
sl@0
|
672 |
|
sl@0
|
673 |
DECLARE_PEM_rw_const(DSAparams, DSA)
|
sl@0
|
674 |
|
sl@0
|
675 |
#endif
|
sl@0
|
676 |
|
sl@0
|
677 |
#ifndef OPENSSL_NO_EC
|
sl@0
|
678 |
DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP)
|
sl@0
|
679 |
DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY)
|
sl@0
|
680 |
DECLARE_PEM_rw(EC_PUBKEY, EC_KEY)
|
sl@0
|
681 |
#endif
|
sl@0
|
682 |
|
sl@0
|
683 |
#ifndef OPENSSL_NO_DH
|
sl@0
|
684 |
|
sl@0
|
685 |
DECLARE_PEM_rw_const(DHparams, DH)
|
sl@0
|
686 |
|
sl@0
|
687 |
#endif
|
sl@0
|
688 |
|
sl@0
|
689 |
DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY)
|
sl@0
|
690 |
|
sl@0
|
691 |
DECLARE_PEM_rw(PUBKEY, EVP_PKEY)
|
sl@0
|
692 |
|
sl@0
|
693 |
IMPORT_C int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid,
|
sl@0
|
694 |
char *kstr, int klen,
|
sl@0
|
695 |
pem_password_cb *cb, void *u);
|
sl@0
|
696 |
IMPORT_C int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *,
|
sl@0
|
697 |
char *, int, pem_password_cb *, void *);
|
sl@0
|
698 |
IMPORT_C int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
|
sl@0
|
699 |
char *kstr, int klen,
|
sl@0
|
700 |
pem_password_cb *cb, void *u);
|
sl@0
|
701 |
IMPORT_C int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,
|
sl@0
|
702 |
char *kstr, int klen,
|
sl@0
|
703 |
pem_password_cb *cb, void *u);
|
sl@0
|
704 |
IMPORT_C EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u);
|
sl@0
|
705 |
|
sl@0
|
706 |
IMPORT_C int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
|
sl@0
|
707 |
char *kstr, int klen,
|
sl@0
|
708 |
pem_password_cb *cb, void *u);
|
sl@0
|
709 |
IMPORT_C int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid,
|
sl@0
|
710 |
char *kstr, int klen,
|
sl@0
|
711 |
pem_password_cb *cb, void *u);
|
sl@0
|
712 |
IMPORT_C int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid,
|
sl@0
|
713 |
char *kstr, int klen,
|
sl@0
|
714 |
pem_password_cb *cb, void *u);
|
sl@0
|
715 |
|
sl@0
|
716 |
IMPORT_C EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u);
|
sl@0
|
717 |
|
sl@0
|
718 |
IMPORT_C int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc,
|
sl@0
|
719 |
char *kstr,int klen, pem_password_cb *cd, void *u);
|
sl@0
|
720 |
|
sl@0
|
721 |
#endif /* SSLEAY_MACROS */
|
sl@0
|
722 |
|
sl@0
|
723 |
|
sl@0
|
724 |
/* BEGIN ERROR CODES */
|
sl@0
|
725 |
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
sl@0
|
726 |
* made after this point may be overwritten when the script is next run.
|
sl@0
|
727 |
*/
|
sl@0
|
728 |
IMPORT_C void ERR_load_PEM_strings(void);
|
sl@0
|
729 |
|
sl@0
|
730 |
/* Error codes for the PEM functions. */
|
sl@0
|
731 |
|
sl@0
|
732 |
/* Function codes. */
|
sl@0
|
733 |
#define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120
|
sl@0
|
734 |
#define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121
|
sl@0
|
735 |
#define PEM_F_DO_PK8PKEY 126
|
sl@0
|
736 |
#define PEM_F_DO_PK8PKEY_FP 125
|
sl@0
|
737 |
#define PEM_F_LOAD_IV 101
|
sl@0
|
738 |
#define PEM_F_PEM_ASN1_READ 102
|
sl@0
|
739 |
#define PEM_F_PEM_ASN1_READ_BIO 103
|
sl@0
|
740 |
#define PEM_F_PEM_ASN1_WRITE 104
|
sl@0
|
741 |
#define PEM_F_PEM_ASN1_WRITE_BIO 105
|
sl@0
|
742 |
#define PEM_F_PEM_DEF_CALLBACK 100
|
sl@0
|
743 |
#define PEM_F_PEM_DO_HEADER 106
|
sl@0
|
744 |
#define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY 118
|
sl@0
|
745 |
#define PEM_F_PEM_GET_EVP_CIPHER_INFO 107
|
sl@0
|
746 |
#define PEM_F_PEM_PK8PKEY 119
|
sl@0
|
747 |
#define PEM_F_PEM_READ 108
|
sl@0
|
748 |
#define PEM_F_PEM_READ_BIO 109
|
sl@0
|
749 |
#define PEM_F_PEM_READ_BIO_PRIVATEKEY 123
|
sl@0
|
750 |
#define PEM_F_PEM_READ_PRIVATEKEY 124
|
sl@0
|
751 |
#define PEM_F_PEM_SEALFINAL 110
|
sl@0
|
752 |
#define PEM_F_PEM_SEALINIT 111
|
sl@0
|
753 |
#define PEM_F_PEM_SIGNFINAL 112
|
sl@0
|
754 |
#define PEM_F_PEM_WRITE 113
|
sl@0
|
755 |
#define PEM_F_PEM_WRITE_BIO 114
|
sl@0
|
756 |
#define PEM_F_PEM_X509_INFO_READ 115
|
sl@0
|
757 |
#define PEM_F_PEM_X509_INFO_READ_BIO 116
|
sl@0
|
758 |
#define PEM_F_PEM_X509_INFO_WRITE_BIO 117
|
sl@0
|
759 |
|
sl@0
|
760 |
/* Reason codes. */
|
sl@0
|
761 |
#define PEM_R_BAD_BASE64_DECODE 100
|
sl@0
|
762 |
#define PEM_R_BAD_DECRYPT 101
|
sl@0
|
763 |
#define PEM_R_BAD_END_LINE 102
|
sl@0
|
764 |
#define PEM_R_BAD_IV_CHARS 103
|
sl@0
|
765 |
#define PEM_R_BAD_PASSWORD_READ 104
|
sl@0
|
766 |
#define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115
|
sl@0
|
767 |
#define PEM_R_NOT_DEK_INFO 105
|
sl@0
|
768 |
#define PEM_R_NOT_ENCRYPTED 106
|
sl@0
|
769 |
#define PEM_R_NOT_PROC_TYPE 107
|
sl@0
|
770 |
#define PEM_R_NO_START_LINE 108
|
sl@0
|
771 |
#define PEM_R_PROBLEMS_GETTING_PASSWORD 109
|
sl@0
|
772 |
#define PEM_R_PUBLIC_KEY_NO_RSA 110
|
sl@0
|
773 |
#define PEM_R_READ_KEY 111
|
sl@0
|
774 |
#define PEM_R_SHORT_HEADER 112
|
sl@0
|
775 |
#define PEM_R_UNSUPPORTED_CIPHER 113
|
sl@0
|
776 |
#define PEM_R_UNSUPPORTED_ENCRYPTION 114
|
sl@0
|
777 |
|
sl@0
|
778 |
#ifdef __cplusplus
|
sl@0
|
779 |
}
|
sl@0
|
780 |
#endif
|
sl@0
|
781 |
#endif
|