]> git.ipfire.org Git - thirdparty/openssl.git/blame - include/openssl/pem.h
Slight cleanup of the collection of READMEs, INSTALLs and NOTES
[thirdparty/openssl.git] / include / openssl / pem.h
CommitLineData
21dcbebc
RS
1/*
2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
d02b48c6 3 *
21dcbebc
RS
4 * Licensed under the OpenSSL license (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
d02b48c6
RE
8 */
9
d02b48c6 10#ifndef HEADER_PEM_H
0f113f3e
MC
11# define HEADER_PEM_H
12
13# include <openssl/e_os2.h>
a00ae6c4
RS
14# include <openssl/bio.h>
15# include <openssl/stack.h>
0f113f3e
MC
16# include <openssl/evp.h>
17# include <openssl/x509.h>
18# include <openssl/pem2.h>
d02b48c6 19
82271cee
RL
20#ifdef __cplusplus
21extern "C" {
22#endif
23
0f113f3e
MC
24# define PEM_BUFSIZE 1024
25
0f113f3e
MC
26# define PEM_STRING_X509_OLD "X509 CERTIFICATE"
27# define PEM_STRING_X509 "CERTIFICATE"
0f113f3e
MC
28# define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE"
29# define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST"
30# define PEM_STRING_X509_REQ "CERTIFICATE REQUEST"
31# define PEM_STRING_X509_CRL "X509 CRL"
32# define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY"
33# define PEM_STRING_PUBLIC "PUBLIC KEY"
34# define PEM_STRING_RSA "RSA PRIVATE KEY"
35# define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY"
36# define PEM_STRING_DSA "DSA PRIVATE KEY"
37# define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY"
38# define PEM_STRING_PKCS7 "PKCS7"
39# define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA"
40# define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY"
41# define PEM_STRING_PKCS8INF "PRIVATE KEY"
42# define PEM_STRING_DHPARAMS "DH PARAMETERS"
43# define PEM_STRING_DHXPARAMS "X9.42 DH PARAMETERS"
44# define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS"
45# define PEM_STRING_DSAPARAMS "DSA PARAMETERS"
46# define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY"
47# define PEM_STRING_ECPARAMETERS "EC PARAMETERS"
48# define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY"
49# define PEM_STRING_PARAMETERS "PARAMETERS"
50# define PEM_STRING_CMS "CMS"
51
0f113f3e
MC
52# define PEM_TYPE_ENCRYPTED 10
53# define PEM_TYPE_MIC_ONLY 20
54# define PEM_TYPE_MIC_CLEAR 30
55# define PEM_TYPE_CLEAR 40
56
57typedef struct pem_recip_st {
58 char *name;
59 X509_NAME *dn;
60 int cipher;
61 int key_enc;
62 /* char iv[8]; unused and wrong size */
63} PEM_USER;
64
65typedef struct pem_ctx_st {
66 int type; /* what type of object */
67 struct {
68 int version;
69 int mode;
70 } proc_type;
71
72 char *domain;
73
74 struct {
75 int cipher;
76 /*-
35a1cc90
MC
77 unused, and wrong size
78 unsigned char iv[8]; */
0f113f3e
MC
79 } DEK_info;
80
81 PEM_USER *originator;
82
83 int num_recipient;
84 PEM_USER **recipient;
85
50e735f9
MC
86/*-
87 XXX(ben): don#t think this is used!
88 STACK *x509_chain; / * certificate chain */
0f113f3e
MC
89 EVP_MD *md; /* signature type */
90
91 int md_enc; /* is the md encrypted or not? */
92 int md_len; /* length of md_data */
93 char *md_data; /* message digest, could be pkey encrypted */
94
95 EVP_CIPHER *dec; /* date encryption cipher */
96 int key_len; /* key length */
97 unsigned char *key; /* key */
35a1cc90
MC
98 /*-
99 unused, and wrong size
100 unsigned char iv[8]; */
0f113f3e
MC
101
102 int data_enc; /* is the data encrypted */
103 int data_len;
104 unsigned char *data;
105} PEM_CTX;
106
107/*
108 * These macros make the PEM_read/PEM_write functions easier to maintain and
109 * write. Now they are all implemented with either: IMPLEMENT_PEM_rw(...) or
110 * IMPLEMENT_PEM_rw_cb(...)
f62676b9
DSH
111 */
112
0f113f3e 113# ifdef OPENSSL_NO_STDIO
f62676b9 114
0f113f3e
MC
115# define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/
116# define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/
117# define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/
118# define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/
119# define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/
120# else
f62676b9 121
0f113f3e 122# define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \
74678cc2 123type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\
f62676b9 124{ \
297e6f19 125return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \
0f113f3e 126}
f62676b9 127
0f113f3e 128# define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \
f62676b9
DSH
129int PEM_write_##name(FILE *fp, type *x) \
130{ \
297e6f19 131return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \
41a15c4f
BL
132}
133
0f113f3e 134# define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \
67ffa18c 135int PEM_write_##name(FILE *fp, const type *x) \
41a15c4f 136{ \
297e6f19 137return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \
a2400fca 138}
f62676b9 139
0f113f3e 140# define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \
f62676b9 141int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
0f113f3e
MC
142 unsigned char *kstr, int klen, pem_password_cb *cb, \
143 void *u) \
144 { \
145 return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \
146 }
41a15c4f 147
0f113f3e 148# define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \
41a15c4f 149int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
0f113f3e
MC
150 unsigned char *kstr, int klen, pem_password_cb *cb, \
151 void *u) \
152 { \
153 return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \
154 }
f62676b9 155
0f113f3e 156# endif
f62676b9 157
0f113f3e 158# define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
74678cc2 159type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\
f62676b9 160{ \
297e6f19 161return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \
f62676b9
DSH
162}
163
0f113f3e 164# define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
f62676b9
DSH
165int PEM_write_bio_##name(BIO *bp, type *x) \
166{ \
297e6f19 167return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \
41a15c4f
BL
168}
169
0f113f3e 170# define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
67ffa18c 171int PEM_write_bio_##name(BIO *bp, const type *x) \
41a15c4f 172{ \
297e6f19 173return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \
f62676b9
DSH
174}
175
0f113f3e 176# define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
f62676b9 177int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
0f113f3e
MC
178 unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
179 { \
180 return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \
181 }
41a15c4f 182
0f113f3e 183# define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
41a15c4f 184int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
0f113f3e
MC
185 unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
186 { \
187 return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \
188 }
f62676b9 189
0f113f3e
MC
190# define IMPLEMENT_PEM_write(name, type, str, asn1) \
191 IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
192 IMPLEMENT_PEM_write_fp(name, type, str, asn1)
f62676b9 193
0f113f3e
MC
194# define IMPLEMENT_PEM_write_const(name, type, str, asn1) \
195 IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
196 IMPLEMENT_PEM_write_fp_const(name, type, str, asn1)
41a15c4f 197
0f113f3e
MC
198# define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \
199 IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
200 IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1)
f62676b9 201
0f113f3e
MC
202# define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \
203 IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
204 IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1)
41a15c4f 205
0f113f3e
MC
206# define IMPLEMENT_PEM_read(name, type, str, asn1) \
207 IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
208 IMPLEMENT_PEM_read_fp(name, type, str, asn1)
f62676b9 209
0f113f3e
MC
210# define IMPLEMENT_PEM_rw(name, type, str, asn1) \
211 IMPLEMENT_PEM_read(name, type, str, asn1) \
212 IMPLEMENT_PEM_write(name, type, str, asn1)
f62676b9 213
0f113f3e
MC
214# define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \
215 IMPLEMENT_PEM_read(name, type, str, asn1) \
216 IMPLEMENT_PEM_write_const(name, type, str, asn1)
41a15c4f 217
0f113f3e
MC
218# define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \
219 IMPLEMENT_PEM_read(name, type, str, asn1) \
220 IMPLEMENT_PEM_write_cb(name, type, str, asn1)
f62676b9 221
dbd665c2
DSH
222/* These are the same except they are for the declarations */
223
0f113f3e
MC
224# if defined(OPENSSL_NO_STDIO)
225
226# define DECLARE_PEM_read_fp(name, type) /**/
227# define DECLARE_PEM_write_fp(name, type) /**/
984d6c60 228# define DECLARE_PEM_write_fp_const(name, type) /**/
0f113f3e
MC
229# define DECLARE_PEM_write_cb_fp(name, type) /**/
230# else
231
232# define DECLARE_PEM_read_fp(name, type) \
233 type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u);
234
235# define DECLARE_PEM_write_fp(name, type) \
236 int PEM_write_##name(FILE *fp, type *x);
237
238# define DECLARE_PEM_write_fp_const(name, type) \
239 int PEM_write_##name(FILE *fp, const type *x);
240
241# define DECLARE_PEM_write_cb_fp(name, type) \
242 int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
243 unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
244
245# endif
246
0f113f3e
MC
247# define DECLARE_PEM_read_bio(name, type) \
248 type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u);
249
250# define DECLARE_PEM_write_bio(name, type) \
251 int PEM_write_bio_##name(BIO *bp, type *x);
252
253# define DECLARE_PEM_write_bio_const(name, type) \
254 int PEM_write_bio_##name(BIO *bp, const type *x);
255
256# define DECLARE_PEM_write_cb_bio(name, type) \
257 int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
258 unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
259
0f113f3e
MC
260# define DECLARE_PEM_write(name, type) \
261 DECLARE_PEM_write_bio(name, type) \
262 DECLARE_PEM_write_fp(name, type)
263# define DECLARE_PEM_write_const(name, type) \
264 DECLARE_PEM_write_bio_const(name, type) \
265 DECLARE_PEM_write_fp_const(name, type)
266# define DECLARE_PEM_write_cb(name, type) \
267 DECLARE_PEM_write_cb_bio(name, type) \
268 DECLARE_PEM_write_cb_fp(name, type)
269# define DECLARE_PEM_read(name, type) \
270 DECLARE_PEM_read_bio(name, type) \
271 DECLARE_PEM_read_fp(name, type)
272# define DECLARE_PEM_rw(name, type) \
273 DECLARE_PEM_read(name, type) \
274 DECLARE_PEM_write(name, type)
275# define DECLARE_PEM_rw_const(name, type) \
276 DECLARE_PEM_read(name, type) \
277 DECLARE_PEM_write_const(name, type)
278# define DECLARE_PEM_rw_cb(name, type) \
279 DECLARE_PEM_read(name, type) \
280 DECLARE_PEM_write_cb(name, type)
0f113f3e 281typedef int pem_password_cb (char *buf, int size, int rwflag, void *userdata);
0f113f3e
MC
282
283int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher);
284int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len,
285 pem_password_cb *callback, void *u);
286
0f113f3e
MC
287int PEM_read_bio(BIO *bp, char **name, char **header,
288 unsigned char **data, long *len);
289int PEM_write_bio(BIO *bp, const char *name, const char *hdr,
290 const unsigned char *data, long len);
291int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm,
292 const char *name, BIO *bp, pem_password_cb *cb,
293 void *u);
294void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x,
295 pem_password_cb *cb, void *u);
296int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x,
297 const EVP_CIPHER *enc, unsigned char *kstr, int klen,
298 pem_password_cb *cb, void *u);
299
300STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk,
301 pem_password_cb *cb, void *u);
302int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc,
303 unsigned char *kstr, int klen,
304 pem_password_cb *cd, void *u);
0f113f3e 305
984d6c60 306#ifndef OPENSSL_NO_STDIO
0f113f3e
MC
307int PEM_read(FILE *fp, char **name, char **header,
308 unsigned char **data, long *len);
309int PEM_write(FILE *fp, const char *name, const char *hdr,
310 const unsigned char *data, long len);
311void *PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x,
312 pem_password_cb *cb, void *u);
313int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp,
314 void *x, const EVP_CIPHER *enc, unsigned char *kstr,
315 int klen, pem_password_cb *callback, void *u);
316STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
317 pem_password_cb *cb, void *u);
984d6c60 318#endif
0f113f3e 319
0f113f3e
MC
320int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type);
321int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt);
322int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
323 unsigned int *siglen, EVP_PKEY *pkey);
324
325int PEM_def_callback(char *buf, int num, int w, void *key);
326void PEM_proc_type(char *buf, int type);
327void PEM_dek_info(char *buf, const char *type, int len, char *str);
328
329# include <openssl/symhacks.h>
8c197cc5 330
dbd665c2 331DECLARE_PEM_rw(X509, X509)
ce1b4fe1 332DECLARE_PEM_rw(X509_AUX, X509)
a8fe430a
MC
333DECLARE_PEM_rw(X509_REQ, X509_REQ)
334DECLARE_PEM_write(X509_REQ_NEW, X509_REQ)
dbd665c2 335DECLARE_PEM_rw(X509_CRL, X509_CRL)
dbd665c2 336DECLARE_PEM_rw(PKCS7, PKCS7)
dbd665c2 337DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE)
dbd665c2 338DECLARE_PEM_rw(PKCS8, X509_SIG)
dbd665c2 339DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
0f113f3e 340# ifndef OPENSSL_NO_RSA
dbd665c2 341DECLARE_PEM_rw_cb(RSAPrivateKey, RSA)
a8fe430a
MC
342DECLARE_PEM_rw_const(RSAPublicKey, RSA)
343DECLARE_PEM_rw(RSA_PUBKEY, RSA)
0f113f3e
MC
344# endif
345# ifndef OPENSSL_NO_DSA
dbd665c2 346DECLARE_PEM_rw_cb(DSAPrivateKey, DSA)
a8fe430a
MC
347DECLARE_PEM_rw(DSA_PUBKEY, DSA)
348DECLARE_PEM_rw_const(DSAparams, DSA)
0f113f3e
MC
349# endif
350# ifndef OPENSSL_NO_EC
67ffa18c 351DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP)
a8fe430a
MC
352DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY)
353DECLARE_PEM_rw(EC_PUBKEY, EC_KEY)
0f113f3e
MC
354# endif
355# ifndef OPENSSL_NO_DH
a8fe430a
MC
356DECLARE_PEM_rw_const(DHparams, DH)
357DECLARE_PEM_write_const(DHxparams, DH)
0f113f3e 358# endif
a8fe430a
MC
359DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY)
360DECLARE_PEM_rw(PUBKEY, EVP_PKEY)
52664f50 361
525f51f6 362int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid,
0f113f3e
MC
363 char *kstr, int klen,
364 pem_password_cb *cb, void *u);
1d5edd08
RE
365int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *,
366 char *, int, pem_password_cb *, void *);
525f51f6 367int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
0f113f3e
MC
368 char *kstr, int klen,
369 pem_password_cb *cb, void *u);
525f51f6 370int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,
0f113f3e
MC
371 char *kstr, int klen,
372 pem_password_cb *cb, void *u);
373EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
374 void *u);
525f51f6 375
04e381ff 376# ifndef OPENSSL_NO_STDIO
525f51f6 377int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
0f113f3e
MC
378 char *kstr, int klen,
379 pem_password_cb *cb, void *u);
525f51f6 380int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid,
0f113f3e
MC
381 char *kstr, int klen,
382 pem_password_cb *cb, void *u);
525f51f6 383int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid,
0f113f3e
MC
384 char *kstr, int klen,
385 pem_password_cb *cb, void *u);
525f51f6 386
0f113f3e
MC
387EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb,
388 void *u);
525f51f6 389
0f113f3e
MC
390int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
391 char *kstr, int klen, pem_password_cb *cd,
392 void *u);
04e381ff 393# endif
3e4585c8
DSH
394EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x);
395int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x);
396
54c010ab 397# ifndef OPENSSL_NO_DSA
a0156a92
DSH
398EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length);
399EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length);
400EVP_PKEY *b2i_PrivateKey_bio(BIO *in);
401EVP_PKEY *b2i_PublicKey_bio(BIO *in);
402int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk);
403int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk);
54c010ab 404# ifndef OPENSSL_NO_RC4
a0156a92
DSH
405EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u);
406int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel,
0f113f3e 407 pem_password_cb *cb, void *u);
54c010ab 408# endif
0f113f3e 409# endif
a0156a92 410
d02b48c6 411/* BEGIN ERROR CODES */
0f113f3e
MC
412/*
413 * The following lines are auto generated by the script mkerr.pl. Any changes
6d311938
DSH
414 * made after this point may be overwritten when the script is next run.
415 */
b476df64 416void ERR_load_PEM_strings(void);
6d311938 417
d02b48c6
RE
418/* Error codes for the PEM functions. */
419
420/* Function codes. */
0f113f3e
MC
421# define PEM_F_B2I_DSS 127
422# define PEM_F_B2I_PVK_BIO 128
423# define PEM_F_B2I_RSA 129
424# define PEM_F_CHECK_BITLEN_DSA 130
425# define PEM_F_CHECK_BITLEN_RSA 131
426# define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120
427# define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121
428# define PEM_F_DO_B2I 132
429# define PEM_F_DO_B2I_BIO 133
430# define PEM_F_DO_BLOB_HEADER 134
431# define PEM_F_DO_PK8PKEY 126
432# define PEM_F_DO_PK8PKEY_FP 125
433# define PEM_F_DO_PVK_BODY 135
434# define PEM_F_DO_PVK_HEADER 136
435# define PEM_F_I2B_PVK 137
436# define PEM_F_I2B_PVK_BIO 138
437# define PEM_F_LOAD_IV 101
438# define PEM_F_PEM_ASN1_READ 102
439# define PEM_F_PEM_ASN1_READ_BIO 103
440# define PEM_F_PEM_ASN1_WRITE 104
441# define PEM_F_PEM_ASN1_WRITE_BIO 105
442# define PEM_F_PEM_DEF_CALLBACK 100
443# define PEM_F_PEM_DO_HEADER 106
444# define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY 118
445# define PEM_F_PEM_GET_EVP_CIPHER_INFO 107
446# define PEM_F_PEM_PK8PKEY 119
447# define PEM_F_PEM_READ 108
448# define PEM_F_PEM_READ_BIO 109
449# define PEM_F_PEM_READ_BIO_DHPARAMS 141
450# define PEM_F_PEM_READ_BIO_PARAMETERS 140
451# define PEM_F_PEM_READ_BIO_PRIVATEKEY 123
452# define PEM_F_PEM_READ_DHPARAMS 142
453# define PEM_F_PEM_READ_PRIVATEKEY 124
0f113f3e
MC
454# define PEM_F_PEM_SIGNFINAL 112
455# define PEM_F_PEM_WRITE 113
456# define PEM_F_PEM_WRITE_BIO 114
457# define PEM_F_PEM_WRITE_PRIVATEKEY 139
458# define PEM_F_PEM_X509_INFO_READ 115
459# define PEM_F_PEM_X509_INFO_READ_BIO 116
460# define PEM_F_PEM_X509_INFO_WRITE_BIO 117
d02b48c6
RE
461
462/* Reason codes. */
0f113f3e
MC
463# define PEM_R_BAD_BASE64_DECODE 100
464# define PEM_R_BAD_DECRYPT 101
465# define PEM_R_BAD_END_LINE 102
466# define PEM_R_BAD_IV_CHARS 103
467# define PEM_R_BAD_MAGIC_NUMBER 116
468# define PEM_R_BAD_PASSWORD_READ 104
469# define PEM_R_BAD_VERSION_NUMBER 117
470# define PEM_R_BIO_WRITE_FAILURE 118
471# define PEM_R_CIPHER_IS_NULL 127
472# define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115
473# define PEM_R_EXPECTING_PRIVATE_KEY_BLOB 119
474# define PEM_R_EXPECTING_PUBLIC_KEY_BLOB 120
a5a3722b 475# define PEM_R_HEADER_TOO_LONG 128
0f113f3e
MC
476# define PEM_R_INCONSISTENT_HEADER 121
477# define PEM_R_KEYBLOB_HEADER_PARSE_ERROR 122
478# define PEM_R_KEYBLOB_TOO_SHORT 123
a5a3722b 479# define PEM_R_MISSING_DEK_IV 129
0f113f3e
MC
480# define PEM_R_NOT_DEK_INFO 105
481# define PEM_R_NOT_ENCRYPTED 106
482# define PEM_R_NOT_PROC_TYPE 107
483# define PEM_R_NO_START_LINE 108
484# define PEM_R_PROBLEMS_GETTING_PASSWORD 109
485# define PEM_R_PUBLIC_KEY_NO_RSA 110
486# define PEM_R_PVK_DATA_TOO_SHORT 124
487# define PEM_R_PVK_TOO_SHORT 125
488# define PEM_R_READ_KEY 111
489# define PEM_R_SHORT_HEADER 112
a5a3722b 490# define PEM_R_UNEXPECTED_DEK_IV 130
0f113f3e
MC
491# define PEM_R_UNSUPPORTED_CIPHER 113
492# define PEM_R_UNSUPPORTED_ENCRYPTION 114
493# define PEM_R_UNSUPPORTED_KEY_COMPONENTS 126
6d311938 494
d02b48c6
RE
495#ifdef __cplusplus
496}
497#endif
498#endif