57 #ifndef OPENSSL_HEADER_PEM_H 58 #define OPENSSL_HEADER_PEM_H 77 #define PEM_BUFSIZE 1024 79 #define PEM_OBJ_UNDEF 0 80 #define PEM_OBJ_X509 1 81 #define PEM_OBJ_X509_REQ 2 83 #define PEM_OBJ_SSL_SESSION 4 84 #define PEM_OBJ_PRIV_KEY 10 85 #define PEM_OBJ_PRIV_RSA 11 86 #define PEM_OBJ_PRIV_DSA 12 87 #define PEM_OBJ_PRIV_DH 13 88 #define PEM_OBJ_PUB_RSA 14 89 #define PEM_OBJ_PUB_DSA 15 90 #define PEM_OBJ_PUB_DH 16 91 #define PEM_OBJ_DHPARAMS 17 92 #define PEM_OBJ_DSAPARAMS 18 93 #define PEM_OBJ_PRIV_RSA_PUBLIC 19 94 #define PEM_OBJ_PRIV_ECDSA 20 95 #define PEM_OBJ_PUB_ECDSA 21 96 #define PEM_OBJ_ECPARAMETERS 22 99 #define PEM_DEK_DES_CBC 40 100 #define PEM_DEK_IDEA_CBC 45 101 #define PEM_DEK_DES_EDE 50 102 #define PEM_DEK_DES_ECB 60 103 #define PEM_DEK_RSA 70 104 #define PEM_DEK_RSA_MD2 80 105 #define PEM_DEK_RSA_MD5 90 107 #define PEM_MD_MD2 NID_md2 108 #define PEM_MD_MD5 NID_md5 109 #define PEM_MD_SHA NID_sha 110 #define PEM_MD_MD2_RSA NID_md2WithRSAEncryption 111 #define PEM_MD_MD5_RSA NID_md5WithRSAEncryption 112 #define PEM_MD_SHA_RSA NID_sha1WithRSAEncryption 114 #define PEM_STRING_X509_OLD "X509 CERTIFICATE" 115 #define PEM_STRING_X509 "CERTIFICATE" 116 #define PEM_STRING_X509_PAIR "CERTIFICATE PAIR" 117 #define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" 118 #define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" 119 #define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" 120 #define PEM_STRING_X509_CRL "X509 CRL" 121 #define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" 122 #define PEM_STRING_PUBLIC "PUBLIC KEY" 123 #define PEM_STRING_RSA "RSA PRIVATE KEY" 124 #define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" 125 #define PEM_STRING_DSA "DSA PRIVATE KEY" 126 #define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY" 127 #define PEM_STRING_EC "EC PRIVATE KEY" 128 #define PEM_STRING_PKCS7 "PKCS7" 129 #define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA" 130 #define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" 131 #define PEM_STRING_PKCS8INF "PRIVATE KEY" 132 #define PEM_STRING_DHPARAMS "DH PARAMETERS" 133 #define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" 134 #define PEM_STRING_DSAPARAMS "DSA PARAMETERS" 135 #define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" 136 #define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" 137 #define PEM_STRING_CMS "CMS" 149 #define PEM_TYPE_ENCRYPTED 10 150 #define PEM_TYPE_MIC_ONLY 20 151 #define PEM_TYPE_MIC_CLEAR 30 152 #define PEM_TYPE_CLEAR 40 209 #ifdef OPENSSL_NO_FP_API 211 #define IMPLEMENT_PEM_read_fp(name, type, str, asn1) 212 #define IMPLEMENT_PEM_write_fp(name, type, str, asn1) 213 #define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) 214 #define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) 215 #define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) 219 #define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ 220 OPENSSL_EXPORT type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ 222 return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \ 225 #define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ 226 OPENSSL_EXPORT int PEM_write_##name(FILE *fp, type *x) \ 228 return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \ 231 #define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ 232 OPENSSL_EXPORT int PEM_write_##name(FILE *fp, const type *x) \ 234 return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \ 237 #define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ 238 OPENSSL_EXPORT int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ 239 unsigned char *kstr, int klen, pem_password_cb *cb, \ 242 return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ 245 #define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ 246 OPENSSL_EXPORT int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ 247 unsigned char *kstr, int klen, pem_password_cb *cb, \ 250 return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ 255 #define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ 256 OPENSSL_EXPORT type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ 258 return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \ 261 #define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ 262 OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, type *x) \ 264 return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \ 267 #define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ 268 OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, const type *x) \ 270 return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \ 273 #define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ 274 OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ 275 unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ 277 return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \ 280 #define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ 281 OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ 282 unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ 284 return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \ 287 #define IMPLEMENT_PEM_write(name, type, str, asn1) \ 288 IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ 289 IMPLEMENT_PEM_write_fp(name, type, str, asn1) 291 #define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ 292 IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ 293 IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) 295 #define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ 296 IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ 297 IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) 299 #define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ 300 IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ 301 IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) 303 #define IMPLEMENT_PEM_read(name, type, str, asn1) \ 304 IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ 305 IMPLEMENT_PEM_read_fp(name, type, str, asn1) 307 #define IMPLEMENT_PEM_rw(name, type, str, asn1) \ 308 IMPLEMENT_PEM_read(name, type, str, asn1) \ 309 IMPLEMENT_PEM_write(name, type, str, asn1) 311 #define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ 312 IMPLEMENT_PEM_read(name, type, str, asn1) \ 313 IMPLEMENT_PEM_write_const(name, type, str, asn1) 315 #define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ 316 IMPLEMENT_PEM_read(name, type, str, asn1) \ 317 IMPLEMENT_PEM_write_cb(name, type, str, asn1) 321 #if defined(OPENSSL_NO_FP_API) 323 #define DECLARE_PEM_read_fp(name, type) 324 #define DECLARE_PEM_write_fp(name, type) 325 #define DECLARE_PEM_write_cb_fp(name, type) 329 #define DECLARE_PEM_read_fp(name, type) \ 330 OPENSSL_EXPORT type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u); 332 #define DECLARE_PEM_write_fp(name, type) \ 333 OPENSSL_EXPORT int PEM_write_##name(FILE *fp, type *x); 335 #define DECLARE_PEM_write_fp_const(name, type) \ 336 OPENSSL_EXPORT int PEM_write_##name(FILE *fp, const type *x); 338 #define DECLARE_PEM_write_cb_fp(name, type) \ 339 OPENSSL_EXPORT int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ 340 unsigned char *kstr, int klen, pem_password_cb *cb, void *u); 344 #define DECLARE_PEM_read_bio(name, type) \ 345 OPENSSL_EXPORT type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u); 347 #define DECLARE_PEM_write_bio(name, type) \ 348 OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, type *x); 350 #define DECLARE_PEM_write_bio_const(name, type) \ 351 OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, const type *x); 353 #define DECLARE_PEM_write_cb_bio(name, type) \ 354 OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ 355 unsigned char *kstr, int klen, pem_password_cb *cb, void *u); 358 #define DECLARE_PEM_write(name, type) \ 359 DECLARE_PEM_write_bio(name, type) \ 360 DECLARE_PEM_write_fp(name, type) 362 #define DECLARE_PEM_write_const(name, type) \ 363 DECLARE_PEM_write_bio_const(name, type) \ 364 DECLARE_PEM_write_fp_const(name, type) 366 #define DECLARE_PEM_write_cb(name, type) \ 367 DECLARE_PEM_write_cb_bio(name, type) \ 368 DECLARE_PEM_write_cb_fp(name, type) 370 #define DECLARE_PEM_read(name, type) \ 371 DECLARE_PEM_read_bio(name, type) \ 372 DECLARE_PEM_read_fp(name, type) 374 #define DECLARE_PEM_rw(name, type) \ 375 DECLARE_PEM_read(name, type) \ 376 DECLARE_PEM_write(name, type) 378 #define DECLARE_PEM_rw_const(name, type) \ 379 DECLARE_PEM_read(name, type) \ 380 DECLARE_PEM_write_const(name, type) 382 #define DECLARE_PEM_rw_cb(name, type) \ 383 DECLARE_PEM_read(name, type) \ 384 DECLARE_PEM_write_cb(name, type) 449 #ifndef OPENSSL_NO_DSA 501 #define PEM_R_BAD_BASE64_DECODE 100 502 #define PEM_R_BAD_DECRYPT 101 503 #define PEM_R_BAD_END_LINE 102 504 #define PEM_R_BAD_IV_CHARS 103 505 #define PEM_R_BAD_PASSWORD_READ 104 506 #define PEM_R_CIPHER_IS_NULL 105 507 #define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 106 508 #define PEM_R_NOT_DEK_INFO 107 509 #define PEM_R_NOT_ENCRYPTED 108 510 #define PEM_R_NOT_PROC_TYPE 109 511 #define PEM_R_NO_START_LINE 110 512 #define PEM_R_READ_KEY 111 513 #define PEM_R_SHORT_HEADER 112 514 #define PEM_R_UNSUPPORTED_CIPHER 113 515 #define PEM_R_UNSUPPORTED_ENCRYPTION 114 int num_recipient
Definition: pem.h:183
OPENSSL_EXPORT EVP_PKEY * d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u)
Definition: pem_pk8.c:237
OPENSSL_EXPORT int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cb, void *u)
Definition: pem_pk8.c:96
OPENSSL_EXPORT int PEM_write(FILE *fp, const char *name, const char *hdr, const unsigned char *data, long len)
Definition: pem_lib.c:504
EGLStreamKHR EGLint EGLint EGLint size
Definition: eglext.h:984
OPENSSL_EXPORT int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl, unsigned char *out, int *outl, EVP_PKEY *priv)
OPENSSL_EXPORT int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u)
Definition: pem_pk8.c:201
OPENSSL_EXPORT int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type, unsigned char **ek, int *ekl, unsigned char *iv, EVP_PKEY **pubk, int npubk)
OPENSSL_EXPORT EVP_PKEY * b2i_PublicKey(const unsigned char **in, long length)
unsigned char * data
Definition: pem.h:201
OPENSSL_EXPORT pem_password_cb * cb
Definition: pem.h:398
OPENSSL_EXPORT int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, void *u)
Definition: pem_lib.c:251
OPENSSL_EXPORT int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher)
Definition: pem_lib.c:416
int mode
Definition: pem.h:170
EVP_MD * md
Definition: pem.h:186
OPENSSL_EXPORT void PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt)
int data_len
Definition: pem.h:200
OPENSSL_EXPORT pem_password_cb void * u
Definition: pem.h:398
Definition: internal.h:67
OPENSSL_EXPORT int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk)
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: gl2ext.h:134
AVCFAssetRef CFArrayRef AVCFAssetLoadValuesCompletionCallback callback
Definition: AVFoundationCFSoftLinking.h:99
OPENSSL_EXPORT int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u)
Definition: pem_pk8.c:208
OPENSSL_EXPORT EVP_PKEY * b2i_PrivateKey(const unsigned char **in, long length)
unsigned char * key
Definition: pem.h:194
char * domain
Definition: pem.h:173
X509_NAME * dn
Definition: pem.h:157
OPENSSL_EXPORT EVP_PKEY * b2i_PrivateKey_bio(BIO *in)
OPENSSL_EXPORT EVP_PKEY * b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u)
int version
Definition: pem.h:169
char * name
Definition: pem.h:156
OPENSSL_EXPORT int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, EVP_PKEY *pkey)
Definition: internal.h:232
PEM_USER * originator
Definition: pem.h:181
EVP_CIPHER_CTX cipher
Definition: pem.h:145
OPENSSL_EXPORT int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, void *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *callback, void *u)
Definition: pem_lib.c:233
OPENSSL_EXPORT int nid
Definition: x509.h:1056
PEM_USER ** recipient
Definition: pem.h:184
OPENSSL_EXPORT int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, pem_password_cb *cb, void *u)
OPENSSL_EXPORT const ASN1_OBJECT int const unsigned char int len
Definition: x509.h:1053
int pem_password_cb(char *buf, int size, int rwflag, void *userdata)
Definition: pem.h:387
int key_len
Definition: pem.h:193
EGLSurface EGLint x
Definition: eglext.h:950
int int * out
Definition: gcc-loops.cpp:206
#define OPENSSL_EXPORT
Definition: base.h:160
int key_enc
Definition: pem.h:160
EGLContext ctx
Definition: eglext.h:192
OPENSSL_EXPORT STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp
OPENSSL_EXPORT void PEM_dek_info(char *buf, const char *type, int len, char *str)
Definition: pem_lib.c:97
int cipher
Definition: pem.h:159
EGLImageKHR EGLint * name
Definition: eglext.h:851
OPENSSL_EXPORT void * PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, pem_password_cb *cb, void *u)
Definition: pem_lib.c:118
int type
Definition: pem.h:166
OPENSSL_EXPORT EVP_PKEY * b2i_PublicKey_bio(BIO *in)
EVP_ENCODE_CTX encode
Definition: pem.h:143
#define DECLARE_PEM_rw(name, type)
Definition: pem.h:374
OPENSSL_EXPORT int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cb, void *u)
Definition: pem_pk8.c:195
OPENSSL_EXPORT void PEM_SealUpdate(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *out, int *outl, unsigned char *in, int inl)
EVP_MD_CTX md
Definition: pem.h:144
OPENSSL_EXPORT int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data, long *len)
Definition: pem_lib.c:597
EGLenum type
Definition: eglext.h:63
int md_enc
Definition: pem.h:188
EGLStreamKHR EGLint EGLint EGLint const void * data
Definition: eglext.h:984
str
Definition: make-dist.py:305
OPENSSL_EXPORT int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk)
const char * header
Definition: gflags_completions.cc:514
struct pem_ctx_st PEM_CTX
char * md_data
Definition: pem.h:190
OPENSSL_EXPORT int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cd, void *u)
Definition: pem_pk8.c:215
#define DECLARE_PEM_write(name, type)
Definition: pem.h:358
OPENSSL_EXPORT int PEM_def_callback(char *buf, int size, int rwflag, void *userdata)
Definition: pem_lib.c:767
void ERR_load_PEM_strings(void)
OPENSSL_EXPORT int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u)
Definition: pem_pk8.c:103
OPENSSL_EXPORT EVP_PKEY * d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u)
Definition: pem_pk8.c:156
#define DECLARE_PEM_rw_cb(name, type)
Definition: pem.h:382
#define DECLARE_PEM_rw_const(name, type)
Definition: pem.h:378
OPENSSL_EXPORT int PEM_read(FILE *fp, char **name, char **header, unsigned char **data, long *len)
Definition: pem_lib.c:580
OPENSSL_EXPORT void PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type)
OPENSSL_EXPORT int PEM_write_bio(BIO *bp, const char *name, const char *hdr, const unsigned char *data, long len)
Definition: pem_lib.c:521
EVP_CIPHER * dec
Definition: pem.h:192
OPENSSL_EXPORT int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cd, void *u)
Definition: pem_info.c:296
int data_enc
Definition: pem.h:199
int md_len
Definition: pem.h:189
OPENSSL_EXPORT void * PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, pem_password_cb *cb, void *u)
Definition: pem_oth.c:72
OPENSSL_EXPORT void PEM_proc_type(char *buf, int type)
Definition: pem_lib.c:79
struct PEM_Encode_Seal_st PEM_ENCODE_SEAL_CTX
int cipher
Definition: pem.h:176
X509 X509_REQ X509_CRL X509_SIG RSA RSA DSA EC_KEY DH EVP_PKEY OPENSSL_EXPORT int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u)
Definition: pem_pk8.c:82
OPENSSL_EXPORT int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char *name, BIO *bp, pem_password_cb *cb, void *u)
Definition: pem_lib.c:188
OPENSSL_EXPORT int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *, char *, int, pem_password_cb *, void *)
Definition: pem_pk8.c:89
OPENSSL_EXPORT int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len, pem_password_cb *callback, void *u)
Definition: pem_lib.c:350
plen
Definition: parse_delay_file.m:33
#define d
Definition: float-mm.c:30
GLuint GLsizei GLsizei * length
Definition: gl2.h:435
struct pem_recip_st PEM_USER