Fix no-dsa on Windows/VMS
[openssl.git] / include / openssl / pem.h
1 /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
2  * All rights reserved.
3  *
4  * This package is an SSL implementation written
5  * by Eric Young (eay@cryptsoft.com).
6  * The implementation was written so as to conform with Netscapes SSL.
7  *
8  * This library is free for commercial and non-commercial use as long as
9  * the following conditions are aheared to.  The following conditions
10  * apply to all code found in this distribution, be it the RC4, RSA,
11  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
12  * included with this distribution is covered by the same copyright terms
13  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
14  *
15  * Copyright remains Eric Young's, and as such any Copyright notices in
16  * the code are not to be removed.
17  * If this package is used in a product, Eric Young should be given attribution
18  * as the author of the parts of the library used.
19  * This can be in the form of a textual message at program startup or
20  * in documentation (online or textual) provided with the package.
21  *
22  * Redistribution and use in source and binary forms, with or without
23  * modification, are permitted provided that the following conditions
24  * are met:
25  * 1. Redistributions of source code must retain the copyright
26  *    notice, this list of conditions and the following disclaimer.
27  * 2. Redistributions in binary form must reproduce the above copyright
28  *    notice, this list of conditions and the following disclaimer in the
29  *    documentation and/or other materials provided with the distribution.
30  * 3. All advertising materials mentioning features or use of this software
31  *    must display the following acknowledgement:
32  *    "This product includes cryptographic software written by
33  *     Eric Young (eay@cryptsoft.com)"
34  *    The word 'cryptographic' can be left out if the rouines from the library
35  *    being used are not cryptographic related :-).
36  * 4. If you include any Windows specific code (or a derivative thereof) from
37  *    the apps directory (application code) you must include an acknowledgement:
38  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
39  *
40  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
41  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
44  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50  * SUCH DAMAGE.
51  *
52  * The licence and distribution terms for any publically available version or
53  * derivative of this code cannot be changed.  i.e. this code cannot simply be
54  * copied and put under another distribution licence
55  * [including the GNU Public Licence.]
56  */
57
58 #ifndef HEADER_PEM_H
59 # define HEADER_PEM_H
60
61 # include <openssl/e_os2.h>
62 # include <openssl/bio.h>
63 # include <openssl/stack.h>
64 # include <openssl/evp.h>
65 # include <openssl/x509.h>
66 # include <openssl/pem2.h>
67
68 #ifdef  __cplusplus
69 extern "C" {
70 #endif
71
72 # define PEM_BUFSIZE             1024
73
74 # define PEM_STRING_X509_OLD     "X509 CERTIFICATE"
75 # define PEM_STRING_X509         "CERTIFICATE"
76 # define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE"
77 # define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST"
78 # define PEM_STRING_X509_REQ     "CERTIFICATE REQUEST"
79 # define PEM_STRING_X509_CRL     "X509 CRL"
80 # define PEM_STRING_EVP_PKEY     "ANY PRIVATE KEY"
81 # define PEM_STRING_PUBLIC       "PUBLIC KEY"
82 # define PEM_STRING_RSA          "RSA PRIVATE KEY"
83 # define PEM_STRING_RSA_PUBLIC   "RSA PUBLIC KEY"
84 # define PEM_STRING_DSA          "DSA PRIVATE KEY"
85 # define PEM_STRING_DSA_PUBLIC   "DSA PUBLIC KEY"
86 # define PEM_STRING_PKCS7        "PKCS7"
87 # define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA"
88 # define PEM_STRING_PKCS8        "ENCRYPTED PRIVATE KEY"
89 # define PEM_STRING_PKCS8INF     "PRIVATE KEY"
90 # define PEM_STRING_DHPARAMS     "DH PARAMETERS"
91 # define PEM_STRING_DHXPARAMS    "X9.42 DH PARAMETERS"
92 # define PEM_STRING_SSL_SESSION  "SSL SESSION PARAMETERS"
93 # define PEM_STRING_DSAPARAMS    "DSA PARAMETERS"
94 # define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY"
95 # define PEM_STRING_ECPARAMETERS "EC PARAMETERS"
96 # define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY"
97 # define PEM_STRING_PARAMETERS   "PARAMETERS"
98 # define PEM_STRING_CMS          "CMS"
99
100 # define PEM_TYPE_ENCRYPTED      10
101 # define PEM_TYPE_MIC_ONLY       20
102 # define PEM_TYPE_MIC_CLEAR      30
103 # define PEM_TYPE_CLEAR          40
104
105 typedef struct pem_recip_st {
106     char *name;
107     X509_NAME *dn;
108     int cipher;
109     int key_enc;
110     /*      char iv[8]; unused and wrong size */
111 } PEM_USER;
112
113 typedef struct pem_ctx_st {
114     int type;                   /* what type of object */
115     struct {
116         int version;
117         int mode;
118     } proc_type;
119
120     char *domain;
121
122     struct {
123         int cipher;
124         /*-
125         unused, and wrong size
126         unsigned char iv[8]; */
127     } DEK_info;
128
129     PEM_USER *originator;
130
131     int num_recipient;
132     PEM_USER **recipient;
133
134 /*-
135     XXX(ben): don#t think this is used!
136         STACK *x509_chain;      / * certificate chain */
137     EVP_MD *md;                 /* signature type */
138
139     int md_enc;                 /* is the md encrypted or not? */
140     int md_len;                 /* length of md_data */
141     char *md_data;              /* message digest, could be pkey encrypted */
142
143     EVP_CIPHER *dec;            /* date encryption cipher */
144     int key_len;                /* key length */
145     unsigned char *key;         /* key */
146   /*-
147     unused, and wrong size
148     unsigned char iv[8]; */
149
150     int data_enc;               /* is the data encrypted */
151     int data_len;
152     unsigned char *data;
153 } PEM_CTX;
154
155 /*
156  * These macros make the PEM_read/PEM_write functions easier to maintain and
157  * write. Now they are all implemented with either: IMPLEMENT_PEM_rw(...) or
158  * IMPLEMENT_PEM_rw_cb(...)
159  */
160
161 # ifdef OPENSSL_NO_STDIO
162
163 #  define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/
164 #  define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/
165 #  define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/
166 #  define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/
167 #  define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/
168 # else
169
170 #  define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \
171 type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\
172 { \
173 return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \
174 }
175
176 #  define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \
177 int PEM_write_##name(FILE *fp, type *x) \
178 { \
179 return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \
180 }
181
182 #  define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \
183 int PEM_write_##name(FILE *fp, const type *x) \
184 { \
185 return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \
186 }
187
188 #  define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \
189 int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
190              unsigned char *kstr, int klen, pem_password_cb *cb, \
191                   void *u) \
192         { \
193         return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \
194         }
195
196 #  define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \
197 int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
198              unsigned char *kstr, int klen, pem_password_cb *cb, \
199                   void *u) \
200         { \
201         return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \
202         }
203
204 # endif
205
206 # define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
207 type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\
208 { \
209 return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \
210 }
211
212 # define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
213 int PEM_write_bio_##name(BIO *bp, type *x) \
214 { \
215 return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \
216 }
217
218 # define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
219 int PEM_write_bio_##name(BIO *bp, const type *x) \
220 { \
221 return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \
222 }
223
224 # define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
225 int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
226              unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
227         { \
228         return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \
229         }
230
231 # define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
232 int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
233              unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
234         { \
235         return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \
236         }
237
238 # define IMPLEMENT_PEM_write(name, type, str, asn1) \
239         IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
240         IMPLEMENT_PEM_write_fp(name, type, str, asn1)
241
242 # define IMPLEMENT_PEM_write_const(name, type, str, asn1) \
243         IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
244         IMPLEMENT_PEM_write_fp_const(name, type, str, asn1)
245
246 # define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \
247         IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
248         IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1)
249
250 # define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \
251         IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
252         IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1)
253
254 # define IMPLEMENT_PEM_read(name, type, str, asn1) \
255         IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
256         IMPLEMENT_PEM_read_fp(name, type, str, asn1)
257
258 # define IMPLEMENT_PEM_rw(name, type, str, asn1) \
259         IMPLEMENT_PEM_read(name, type, str, asn1) \
260         IMPLEMENT_PEM_write(name, type, str, asn1)
261
262 # define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \
263         IMPLEMENT_PEM_read(name, type, str, asn1) \
264         IMPLEMENT_PEM_write_const(name, type, str, asn1)
265
266 # define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \
267         IMPLEMENT_PEM_read(name, type, str, asn1) \
268         IMPLEMENT_PEM_write_cb(name, type, str, asn1)
269
270 /* These are the same except they are for the declarations */
271
272 # if defined(OPENSSL_NO_STDIO)
273
274 #  define DECLARE_PEM_read_fp(name, type) /**/
275 #  define DECLARE_PEM_write_fp(name, type) /**/
276 #  define DECLARE_PEM_write_fp_const(name, type) /**/
277 #  define DECLARE_PEM_write_cb_fp(name, type) /**/
278 # else
279
280 #  define DECLARE_PEM_read_fp(name, type) \
281         type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u);
282
283 #  define DECLARE_PEM_write_fp(name, type) \
284         int PEM_write_##name(FILE *fp, type *x);
285
286 #  define DECLARE_PEM_write_fp_const(name, type) \
287         int PEM_write_##name(FILE *fp, const type *x);
288
289 #  define DECLARE_PEM_write_cb_fp(name, type) \
290         int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
291              unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
292
293 # endif
294
295 #  define DECLARE_PEM_read_bio(name, type) \
296         type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u);
297
298 #  define DECLARE_PEM_write_bio(name, type) \
299         int PEM_write_bio_##name(BIO *bp, type *x);
300
301 #  define DECLARE_PEM_write_bio_const(name, type) \
302         int PEM_write_bio_##name(BIO *bp, const type *x);
303
304 #  define DECLARE_PEM_write_cb_bio(name, type) \
305         int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
306              unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
307
308 # define DECLARE_PEM_write(name, type) \
309         DECLARE_PEM_write_bio(name, type) \
310         DECLARE_PEM_write_fp(name, type)
311 # define DECLARE_PEM_write_const(name, type) \
312         DECLARE_PEM_write_bio_const(name, type) \
313         DECLARE_PEM_write_fp_const(name, type)
314 # define DECLARE_PEM_write_cb(name, type) \
315         DECLARE_PEM_write_cb_bio(name, type) \
316         DECLARE_PEM_write_cb_fp(name, type)
317 # define DECLARE_PEM_read(name, type) \
318         DECLARE_PEM_read_bio(name, type) \
319         DECLARE_PEM_read_fp(name, type)
320 # define DECLARE_PEM_rw(name, type) \
321         DECLARE_PEM_read(name, type) \
322         DECLARE_PEM_write(name, type)
323 # define DECLARE_PEM_rw_const(name, type) \
324         DECLARE_PEM_read(name, type) \
325         DECLARE_PEM_write_const(name, type)
326 # define DECLARE_PEM_rw_cb(name, type) \
327         DECLARE_PEM_read(name, type) \
328         DECLARE_PEM_write_cb(name, type)
329 typedef int pem_password_cb (char *buf, int size, int rwflag, void *userdata);
330
331 int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher);
332 int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len,
333                   pem_password_cb *callback, void *u);
334
335 int PEM_read_bio(BIO *bp, char **name, char **header,
336                  unsigned char **data, long *len);
337 int PEM_write_bio(BIO *bp, const char *name, const char *hdr,
338                   const unsigned char *data, long len);
339 int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm,
340                        const char *name, BIO *bp, pem_password_cb *cb,
341                        void *u);
342 void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x,
343                         pem_password_cb *cb, void *u);
344 int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x,
345                        const EVP_CIPHER *enc, unsigned char *kstr, int klen,
346                        pem_password_cb *cb, void *u);
347
348 STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk,
349                                             pem_password_cb *cb, void *u);
350 int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc,
351                             unsigned char *kstr, int klen,
352                             pem_password_cb *cd, void *u);
353
354 #ifndef OPENSSL_NO_STDIO
355 int PEM_read(FILE *fp, char **name, char **header,
356              unsigned char **data, long *len);
357 int PEM_write(FILE *fp, const char *name, const char *hdr,
358               const unsigned char *data, long len);
359 void *PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x,
360                     pem_password_cb *cb, void *u);
361 int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp,
362                    void *x, const EVP_CIPHER *enc, unsigned char *kstr,
363                    int klen, pem_password_cb *callback, void *u);
364 STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
365                                         pem_password_cb *cb, void *u);
366 #endif
367
368 int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type);
369 int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt);
370 int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
371                   unsigned int *siglen, EVP_PKEY *pkey);
372
373 int PEM_def_callback(char *buf, int num, int w, void *key);
374 void PEM_proc_type(char *buf, int type);
375 void PEM_dek_info(char *buf, const char *type, int len, char *str);
376
377 # include <openssl/symhacks.h>
378
379 DECLARE_PEM_rw(X509, X509)
380 DECLARE_PEM_rw(X509_AUX, X509)
381 DECLARE_PEM_rw(X509_REQ, X509_REQ)
382 DECLARE_PEM_write(X509_REQ_NEW, X509_REQ)
383 DECLARE_PEM_rw(X509_CRL, X509_CRL)
384 DECLARE_PEM_rw(PKCS7, PKCS7)
385 DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE)
386 DECLARE_PEM_rw(PKCS8, X509_SIG)
387 DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
388 # ifndef OPENSSL_NO_RSA
389 DECLARE_PEM_rw_cb(RSAPrivateKey, RSA)
390 DECLARE_PEM_rw_const(RSAPublicKey, RSA)
391 DECLARE_PEM_rw(RSA_PUBKEY, RSA)
392 # endif
393 # ifndef OPENSSL_NO_DSA
394 DECLARE_PEM_rw_cb(DSAPrivateKey, DSA)
395 DECLARE_PEM_rw(DSA_PUBKEY, DSA)
396 DECLARE_PEM_rw_const(DSAparams, DSA)
397 # endif
398 # ifndef OPENSSL_NO_EC
399 DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP)
400 DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY)
401 DECLARE_PEM_rw(EC_PUBKEY, EC_KEY)
402 # endif
403 # ifndef OPENSSL_NO_DH
404 DECLARE_PEM_rw_const(DHparams, DH)
405 DECLARE_PEM_write_const(DHxparams, DH)
406 # endif
407 DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY)
408 DECLARE_PEM_rw(PUBKEY, EVP_PKEY)
409
410 int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid,
411                                       char *kstr, int klen,
412                                       pem_password_cb *cb, void *u);
413 int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *,
414                                   char *, int, pem_password_cb *, void *);
415 int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
416                             char *kstr, int klen,
417                             pem_password_cb *cb, void *u);
418 int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,
419                                 char *kstr, int klen,
420                                 pem_password_cb *cb, void *u);
421 EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
422                                   void *u);
423
424 # ifndef OPENSSL_NO_STDIO
425 int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
426                            char *kstr, int klen,
427                            pem_password_cb *cb, void *u);
428 int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid,
429                                char *kstr, int klen,
430                                pem_password_cb *cb, void *u);
431 int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid,
432                                   char *kstr, int klen,
433                                   pem_password_cb *cb, void *u);
434
435 EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb,
436                                  void *u);
437
438 int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
439                               char *kstr, int klen, pem_password_cb *cd,
440                               void *u);
441 # endif
442 EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x);
443 int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x);
444
445 # ifndef OPENSSL_NO_DSA
446 EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length);
447 EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length);
448 EVP_PKEY *b2i_PrivateKey_bio(BIO *in);
449 EVP_PKEY *b2i_PublicKey_bio(BIO *in);
450 int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk);
451 int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk);
452 #  ifndef OPENSSL_NO_RC4
453 EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u);
454 int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel,
455                 pem_password_cb *cb, void *u);
456 #  endif
457 # endif
458
459 /* BEGIN ERROR CODES */
460 /*
461  * The following lines are auto generated by the script mkerr.pl. Any changes
462  * made after this point may be overwritten when the script is next run.
463  */
464 void ERR_load_PEM_strings(void);
465
466 /* Error codes for the PEM functions. */
467
468 /* Function codes. */
469 # define PEM_F_B2I_DSS                                    127
470 # define PEM_F_B2I_PVK_BIO                                128
471 # define PEM_F_B2I_RSA                                    129
472 # define PEM_F_CHECK_BITLEN_DSA                           130
473 # define PEM_F_CHECK_BITLEN_RSA                           131
474 # define PEM_F_D2I_PKCS8PRIVATEKEY_BIO                    120
475 # define PEM_F_D2I_PKCS8PRIVATEKEY_FP                     121
476 # define PEM_F_DO_B2I                                     132
477 # define PEM_F_DO_B2I_BIO                                 133
478 # define PEM_F_DO_BLOB_HEADER                             134
479 # define PEM_F_DO_PK8PKEY                                 126
480 # define PEM_F_DO_PK8PKEY_FP                              125
481 # define PEM_F_DO_PVK_BODY                                135
482 # define PEM_F_DO_PVK_HEADER                              136
483 # define PEM_F_I2B_PVK                                    137
484 # define PEM_F_I2B_PVK_BIO                                138
485 # define PEM_F_LOAD_IV                                    101
486 # define PEM_F_PEM_ASN1_READ                              102
487 # define PEM_F_PEM_ASN1_READ_BIO                          103
488 # define PEM_F_PEM_ASN1_WRITE                             104
489 # define PEM_F_PEM_ASN1_WRITE_BIO                         105
490 # define PEM_F_PEM_DEF_CALLBACK                           100
491 # define PEM_F_PEM_DO_HEADER                              106
492 # define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY            118
493 # define PEM_F_PEM_GET_EVP_CIPHER_INFO                    107
494 # define PEM_F_PEM_PK8PKEY                                119
495 # define PEM_F_PEM_READ                                   108
496 # define PEM_F_PEM_READ_BIO                               109
497 # define PEM_F_PEM_READ_BIO_DHPARAMS                      141
498 # define PEM_F_PEM_READ_BIO_PARAMETERS                    140
499 # define PEM_F_PEM_READ_BIO_PRIVATEKEY                    123
500 # define PEM_F_PEM_READ_DHPARAMS                          142
501 # define PEM_F_PEM_READ_PRIVATEKEY                        124
502 # define PEM_F_PEM_SIGNFINAL                              112
503 # define PEM_F_PEM_WRITE                                  113
504 # define PEM_F_PEM_WRITE_BIO                              114
505 # define PEM_F_PEM_WRITE_PRIVATEKEY                       139
506 # define PEM_F_PEM_X509_INFO_READ                         115
507 # define PEM_F_PEM_X509_INFO_READ_BIO                     116
508 # define PEM_F_PEM_X509_INFO_WRITE_BIO                    117
509
510 /* Reason codes. */
511 # define PEM_R_BAD_BASE64_DECODE                          100
512 # define PEM_R_BAD_DECRYPT                                101
513 # define PEM_R_BAD_END_LINE                               102
514 # define PEM_R_BAD_IV_CHARS                               103
515 # define PEM_R_BAD_MAGIC_NUMBER                           116
516 # define PEM_R_BAD_PASSWORD_READ                          104
517 # define PEM_R_BAD_VERSION_NUMBER                         117
518 # define PEM_R_BIO_WRITE_FAILURE                          118
519 # define PEM_R_CIPHER_IS_NULL                             127
520 # define PEM_R_ERROR_CONVERTING_PRIVATE_KEY               115
521 # define PEM_R_EXPECTING_PRIVATE_KEY_BLOB                 119
522 # define PEM_R_EXPECTING_PUBLIC_KEY_BLOB                  120
523 # define PEM_R_INCONSISTENT_HEADER                        121
524 # define PEM_R_KEYBLOB_HEADER_PARSE_ERROR                 122
525 # define PEM_R_KEYBLOB_TOO_SHORT                          123
526 # define PEM_R_NOT_DEK_INFO                               105
527 # define PEM_R_NOT_ENCRYPTED                              106
528 # define PEM_R_NOT_PROC_TYPE                              107
529 # define PEM_R_NO_START_LINE                              108
530 # define PEM_R_PROBLEMS_GETTING_PASSWORD                  109
531 # define PEM_R_PUBLIC_KEY_NO_RSA                          110
532 # define PEM_R_PVK_DATA_TOO_SHORT                         124
533 # define PEM_R_PVK_TOO_SHORT                              125
534 # define PEM_R_READ_KEY                                   111
535 # define PEM_R_SHORT_HEADER                               112
536 # define PEM_R_UNSUPPORTED_CIPHER                         113
537 # define PEM_R_UNSUPPORTED_ENCRYPTION                     114
538 # define PEM_R_UNSUPPORTED_KEY_COMPONENTS                 126
539
540 #ifdef  __cplusplus
541 }
542 #endif
543 #endif