pem.h 20 KB

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