1*4724848cSchristos /* 2*4724848cSchristos * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. 3*4724848cSchristos * 4*4724848cSchristos * Licensed under the OpenSSL license (the "License"). You may not use 5*4724848cSchristos * this file except in compliance with the License. You can obtain a copy 6*4724848cSchristos * in the file LICENSE in the source distribution or at 7*4724848cSchristos * https://www.openssl.org/source/license.html 8*4724848cSchristos */ 9*4724848cSchristos 10*4724848cSchristos #ifndef HEADER_PEM_H 11*4724848cSchristos # define HEADER_PEM_H 12*4724848cSchristos 13*4724848cSchristos # include <openssl/e_os2.h> 14*4724848cSchristos # include <openssl/bio.h> 15*4724848cSchristos # include <openssl/safestack.h> 16*4724848cSchristos # include <openssl/evp.h> 17*4724848cSchristos # include <openssl/x509.h> 18*4724848cSchristos # include <openssl/pemerr.h> 19*4724848cSchristos 20*4724848cSchristos #ifdef __cplusplus 21*4724848cSchristos extern "C" { 22*4724848cSchristos #endif 23*4724848cSchristos 24*4724848cSchristos # define PEM_BUFSIZE 1024 25*4724848cSchristos 26*4724848cSchristos # define PEM_STRING_X509_OLD "X509 CERTIFICATE" 27*4724848cSchristos # define PEM_STRING_X509 "CERTIFICATE" 28*4724848cSchristos # define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" 29*4724848cSchristos # define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" 30*4724848cSchristos # define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" 31*4724848cSchristos # define PEM_STRING_X509_CRL "X509 CRL" 32*4724848cSchristos # define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" 33*4724848cSchristos # define PEM_STRING_PUBLIC "PUBLIC KEY" 34*4724848cSchristos # define PEM_STRING_RSA "RSA PRIVATE KEY" 35*4724848cSchristos # define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" 36*4724848cSchristos # define PEM_STRING_DSA "DSA PRIVATE KEY" 37*4724848cSchristos # define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY" 38*4724848cSchristos # define PEM_STRING_PKCS7 "PKCS7" 39*4724848cSchristos # define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA" 40*4724848cSchristos # define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" 41*4724848cSchristos # define PEM_STRING_PKCS8INF "PRIVATE KEY" 42*4724848cSchristos # define PEM_STRING_DHPARAMS "DH PARAMETERS" 43*4724848cSchristos # define PEM_STRING_DHXPARAMS "X9.42 DH PARAMETERS" 44*4724848cSchristos # define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" 45*4724848cSchristos # define PEM_STRING_DSAPARAMS "DSA PARAMETERS" 46*4724848cSchristos # define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" 47*4724848cSchristos # define PEM_STRING_ECPARAMETERS "EC PARAMETERS" 48*4724848cSchristos # define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" 49*4724848cSchristos # define PEM_STRING_PARAMETERS "PARAMETERS" 50*4724848cSchristos # define PEM_STRING_CMS "CMS" 51*4724848cSchristos 52*4724848cSchristos # define PEM_TYPE_ENCRYPTED 10 53*4724848cSchristos # define PEM_TYPE_MIC_ONLY 20 54*4724848cSchristos # define PEM_TYPE_MIC_CLEAR 30 55*4724848cSchristos # define PEM_TYPE_CLEAR 40 56*4724848cSchristos 57*4724848cSchristos /* 58*4724848cSchristos * These macros make the PEM_read/PEM_write functions easier to maintain and 59*4724848cSchristos * write. Now they are all implemented with either: IMPLEMENT_PEM_rw(...) or 60*4724848cSchristos * IMPLEMENT_PEM_rw_cb(...) 61*4724848cSchristos */ 62*4724848cSchristos 63*4724848cSchristos # ifdef OPENSSL_NO_STDIO 64*4724848cSchristos 65*4724848cSchristos # define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/ 66*4724848cSchristos # define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/ 67*4724848cSchristos # define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/ 68*4724848cSchristos # define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/ 69*4724848cSchristos # define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/ 70*4724848cSchristos # else 71*4724848cSchristos 72*4724848cSchristos # define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ 73*4724848cSchristos type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ 74*4724848cSchristos { \ 75*4724848cSchristos return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \ 76*4724848cSchristos } 77*4724848cSchristos 78*4724848cSchristos # define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ 79*4724848cSchristos int PEM_write_##name(FILE *fp, type *x) \ 80*4724848cSchristos { \ 81*4724848cSchristos return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \ 82*4724848cSchristos } 83*4724848cSchristos 84*4724848cSchristos # define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ 85*4724848cSchristos int PEM_write_##name(FILE *fp, const type *x) \ 86*4724848cSchristos { \ 87*4724848cSchristos return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \ 88*4724848cSchristos } 89*4724848cSchristos 90*4724848cSchristos # define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ 91*4724848cSchristos int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ 92*4724848cSchristos unsigned char *kstr, int klen, pem_password_cb *cb, \ 93*4724848cSchristos void *u) \ 94*4724848cSchristos { \ 95*4724848cSchristos return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ 96*4724848cSchristos } 97*4724848cSchristos 98*4724848cSchristos # define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ 99*4724848cSchristos int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ 100*4724848cSchristos unsigned char *kstr, int klen, pem_password_cb *cb, \ 101*4724848cSchristos void *u) \ 102*4724848cSchristos { \ 103*4724848cSchristos return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ 104*4724848cSchristos } 105*4724848cSchristos 106*4724848cSchristos # endif 107*4724848cSchristos 108*4724848cSchristos # define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ 109*4724848cSchristos type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ 110*4724848cSchristos { \ 111*4724848cSchristos return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \ 112*4724848cSchristos } 113*4724848cSchristos 114*4724848cSchristos # define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ 115*4724848cSchristos int PEM_write_bio_##name(BIO *bp, type *x) \ 116*4724848cSchristos { \ 117*4724848cSchristos return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \ 118*4724848cSchristos } 119*4724848cSchristos 120*4724848cSchristos # define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ 121*4724848cSchristos int PEM_write_bio_##name(BIO *bp, const type *x) \ 122*4724848cSchristos { \ 123*4724848cSchristos return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \ 124*4724848cSchristos } 125*4724848cSchristos 126*4724848cSchristos # define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ 127*4724848cSchristos int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ 128*4724848cSchristos unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ 129*4724848cSchristos { \ 130*4724848cSchristos return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \ 131*4724848cSchristos } 132*4724848cSchristos 133*4724848cSchristos # define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ 134*4724848cSchristos int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ 135*4724848cSchristos unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ 136*4724848cSchristos { \ 137*4724848cSchristos return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \ 138*4724848cSchristos } 139*4724848cSchristos 140*4724848cSchristos # define IMPLEMENT_PEM_write(name, type, str, asn1) \ 141*4724848cSchristos IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ 142*4724848cSchristos IMPLEMENT_PEM_write_fp(name, type, str, asn1) 143*4724848cSchristos 144*4724848cSchristos # define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ 145*4724848cSchristos IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ 146*4724848cSchristos IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) 147*4724848cSchristos 148*4724848cSchristos # define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ 149*4724848cSchristos IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ 150*4724848cSchristos IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) 151*4724848cSchristos 152*4724848cSchristos # define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ 153*4724848cSchristos IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ 154*4724848cSchristos IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) 155*4724848cSchristos 156*4724848cSchristos # define IMPLEMENT_PEM_read(name, type, str, asn1) \ 157*4724848cSchristos IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ 158*4724848cSchristos IMPLEMENT_PEM_read_fp(name, type, str, asn1) 159*4724848cSchristos 160*4724848cSchristos # define IMPLEMENT_PEM_rw(name, type, str, asn1) \ 161*4724848cSchristos IMPLEMENT_PEM_read(name, type, str, asn1) \ 162*4724848cSchristos IMPLEMENT_PEM_write(name, type, str, asn1) 163*4724848cSchristos 164*4724848cSchristos # define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ 165*4724848cSchristos IMPLEMENT_PEM_read(name, type, str, asn1) \ 166*4724848cSchristos IMPLEMENT_PEM_write_const(name, type, str, asn1) 167*4724848cSchristos 168*4724848cSchristos # define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ 169*4724848cSchristos IMPLEMENT_PEM_read(name, type, str, asn1) \ 170*4724848cSchristos IMPLEMENT_PEM_write_cb(name, type, str, asn1) 171*4724848cSchristos 172*4724848cSchristos /* These are the same except they are for the declarations */ 173*4724848cSchristos 174*4724848cSchristos # if defined(OPENSSL_NO_STDIO) 175*4724848cSchristos 176*4724848cSchristos # define DECLARE_PEM_read_fp(name, type) /**/ 177*4724848cSchristos # define DECLARE_PEM_write_fp(name, type) /**/ 178*4724848cSchristos # define DECLARE_PEM_write_fp_const(name, type) /**/ 179*4724848cSchristos # define DECLARE_PEM_write_cb_fp(name, type) /**/ 180*4724848cSchristos # else 181*4724848cSchristos 182*4724848cSchristos # define DECLARE_PEM_read_fp(name, type) \ 183*4724848cSchristos type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u); 184*4724848cSchristos 185*4724848cSchristos # define DECLARE_PEM_write_fp(name, type) \ 186*4724848cSchristos int PEM_write_##name(FILE *fp, type *x); 187*4724848cSchristos 188*4724848cSchristos # define DECLARE_PEM_write_fp_const(name, type) \ 189*4724848cSchristos int PEM_write_##name(FILE *fp, const type *x); 190*4724848cSchristos 191*4724848cSchristos # define DECLARE_PEM_write_cb_fp(name, type) \ 192*4724848cSchristos int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ 193*4724848cSchristos unsigned char *kstr, int klen, pem_password_cb *cb, void *u); 194*4724848cSchristos 195*4724848cSchristos # endif 196*4724848cSchristos 197*4724848cSchristos # define DECLARE_PEM_read_bio(name, type) \ 198*4724848cSchristos type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u); 199*4724848cSchristos 200*4724848cSchristos # define DECLARE_PEM_write_bio(name, type) \ 201*4724848cSchristos int PEM_write_bio_##name(BIO *bp, type *x); 202*4724848cSchristos 203*4724848cSchristos # define DECLARE_PEM_write_bio_const(name, type) \ 204*4724848cSchristos int PEM_write_bio_##name(BIO *bp, const type *x); 205*4724848cSchristos 206*4724848cSchristos # define DECLARE_PEM_write_cb_bio(name, type) \ 207*4724848cSchristos int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ 208*4724848cSchristos unsigned char *kstr, int klen, pem_password_cb *cb, void *u); 209*4724848cSchristos 210*4724848cSchristos # define DECLARE_PEM_write(name, type) \ 211*4724848cSchristos DECLARE_PEM_write_bio(name, type) \ 212*4724848cSchristos DECLARE_PEM_write_fp(name, type) 213*4724848cSchristos # define DECLARE_PEM_write_const(name, type) \ 214*4724848cSchristos DECLARE_PEM_write_bio_const(name, type) \ 215*4724848cSchristos DECLARE_PEM_write_fp_const(name, type) 216*4724848cSchristos # define DECLARE_PEM_write_cb(name, type) \ 217*4724848cSchristos DECLARE_PEM_write_cb_bio(name, type) \ 218*4724848cSchristos DECLARE_PEM_write_cb_fp(name, type) 219*4724848cSchristos # define DECLARE_PEM_read(name, type) \ 220*4724848cSchristos DECLARE_PEM_read_bio(name, type) \ 221*4724848cSchristos DECLARE_PEM_read_fp(name, type) 222*4724848cSchristos # define DECLARE_PEM_rw(name, type) \ 223*4724848cSchristos DECLARE_PEM_read(name, type) \ 224*4724848cSchristos DECLARE_PEM_write(name, type) 225*4724848cSchristos # define DECLARE_PEM_rw_const(name, type) \ 226*4724848cSchristos DECLARE_PEM_read(name, type) \ 227*4724848cSchristos DECLARE_PEM_write_const(name, type) 228*4724848cSchristos # define DECLARE_PEM_rw_cb(name, type) \ 229*4724848cSchristos DECLARE_PEM_read(name, type) \ 230*4724848cSchristos DECLARE_PEM_write_cb(name, type) 231*4724848cSchristos typedef int pem_password_cb (char *buf, int size, int rwflag, void *userdata); 232*4724848cSchristos 233*4724848cSchristos int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); 234*4724848cSchristos int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len, 235*4724848cSchristos pem_password_cb *callback, void *u); 236*4724848cSchristos 237*4724848cSchristos int PEM_read_bio(BIO *bp, char **name, char **header, 238*4724848cSchristos unsigned char **data, long *len); 239*4724848cSchristos # define PEM_FLAG_SECURE 0x1 240*4724848cSchristos # define PEM_FLAG_EAY_COMPATIBLE 0x2 241*4724848cSchristos # define PEM_FLAG_ONLY_B64 0x4 242*4724848cSchristos int PEM_read_bio_ex(BIO *bp, char **name, char **header, 243*4724848cSchristos unsigned char **data, long *len, unsigned int flags); 244*4724848cSchristos int PEM_bytes_read_bio_secmem(unsigned char **pdata, long *plen, char **pnm, 245*4724848cSchristos const char *name, BIO *bp, pem_password_cb *cb, 246*4724848cSchristos void *u); 247*4724848cSchristos int PEM_write_bio(BIO *bp, const char *name, const char *hdr, 248*4724848cSchristos const unsigned char *data, long len); 249*4724848cSchristos int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, 250*4724848cSchristos const char *name, BIO *bp, pem_password_cb *cb, 251*4724848cSchristos void *u); 252*4724848cSchristos void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, 253*4724848cSchristos pem_password_cb *cb, void *u); 254*4724848cSchristos int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x, 255*4724848cSchristos const EVP_CIPHER *enc, unsigned char *kstr, int klen, 256*4724848cSchristos pem_password_cb *cb, void *u); 257*4724848cSchristos 258*4724848cSchristos STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, 259*4724848cSchristos pem_password_cb *cb, void *u); 260*4724848cSchristos int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, 261*4724848cSchristos unsigned char *kstr, int klen, 262*4724848cSchristos pem_password_cb *cd, void *u); 263*4724848cSchristos 264*4724848cSchristos #ifndef OPENSSL_NO_STDIO 265*4724848cSchristos int PEM_read(FILE *fp, char **name, char **header, 266*4724848cSchristos unsigned char **data, long *len); 267*4724848cSchristos int PEM_write(FILE *fp, const char *name, const char *hdr, 268*4724848cSchristos const unsigned char *data, long len); 269*4724848cSchristos void *PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, 270*4724848cSchristos pem_password_cb *cb, void *u); 271*4724848cSchristos int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, 272*4724848cSchristos void *x, const EVP_CIPHER *enc, unsigned char *kstr, 273*4724848cSchristos int klen, pem_password_cb *callback, void *u); 274*4724848cSchristos STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, 275*4724848cSchristos pem_password_cb *cb, void *u); 276*4724848cSchristos #endif 277*4724848cSchristos 278*4724848cSchristos int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); 279*4724848cSchristos int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt); 280*4724848cSchristos int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, 281*4724848cSchristos unsigned int *siglen, EVP_PKEY *pkey); 282*4724848cSchristos 283*4724848cSchristos /* The default pem_password_cb that's used internally */ 284*4724848cSchristos int PEM_def_callback(char *buf, int num, int rwflag, void *userdata); 285*4724848cSchristos void PEM_proc_type(char *buf, int type); 286*4724848cSchristos void PEM_dek_info(char *buf, const char *type, int len, char *str); 287*4724848cSchristos 288*4724848cSchristos # include <openssl/symhacks.h> 289*4724848cSchristos 290*4724848cSchristos DECLARE_PEM_rw(X509, X509) 291*4724848cSchristos DECLARE_PEM_rw(X509_AUX, X509) 292*4724848cSchristos DECLARE_PEM_rw(X509_REQ, X509_REQ) 293*4724848cSchristos DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) 294*4724848cSchristos DECLARE_PEM_rw(X509_CRL, X509_CRL) 295*4724848cSchristos DECLARE_PEM_rw(PKCS7, PKCS7) 296*4724848cSchristos DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE) 297*4724848cSchristos DECLARE_PEM_rw(PKCS8, X509_SIG) 298*4724848cSchristos DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) 299*4724848cSchristos # ifndef OPENSSL_NO_RSA 300*4724848cSchristos DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) 301*4724848cSchristos DECLARE_PEM_rw_const(RSAPublicKey, RSA) 302*4724848cSchristos DECLARE_PEM_rw(RSA_PUBKEY, RSA) 303*4724848cSchristos # endif 304*4724848cSchristos # ifndef OPENSSL_NO_DSA 305*4724848cSchristos DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) 306*4724848cSchristos DECLARE_PEM_rw(DSA_PUBKEY, DSA) 307*4724848cSchristos DECLARE_PEM_rw_const(DSAparams, DSA) 308*4724848cSchristos # endif 309*4724848cSchristos # ifndef OPENSSL_NO_EC 310*4724848cSchristos DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP) 311*4724848cSchristos DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY) 312*4724848cSchristos DECLARE_PEM_rw(EC_PUBKEY, EC_KEY) 313*4724848cSchristos # endif 314*4724848cSchristos # ifndef OPENSSL_NO_DH 315*4724848cSchristos DECLARE_PEM_rw_const(DHparams, DH) 316*4724848cSchristos DECLARE_PEM_write_const(DHxparams, DH) 317*4724848cSchristos # endif 318*4724848cSchristos DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY) 319*4724848cSchristos DECLARE_PEM_rw(PUBKEY, EVP_PKEY) 320*4724848cSchristos 321*4724848cSchristos int PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x, 322*4724848cSchristos const EVP_CIPHER *enc, 323*4724848cSchristos unsigned char *kstr, int klen, 324*4724848cSchristos pem_password_cb *cb, void *u); 325*4724848cSchristos 326*4724848cSchristos int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, 327*4724848cSchristos char *kstr, int klen, 328*4724848cSchristos pem_password_cb *cb, void *u); 329*4724848cSchristos int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *, 330*4724848cSchristos char *, int, pem_password_cb *, void *); 331*4724848cSchristos int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, 332*4724848cSchristos char *kstr, int klen, 333*4724848cSchristos pem_password_cb *cb, void *u); 334*4724848cSchristos int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, 335*4724848cSchristos char *kstr, int klen, 336*4724848cSchristos pem_password_cb *cb, void *u); 337*4724848cSchristos EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, 338*4724848cSchristos void *u); 339*4724848cSchristos 340*4724848cSchristos # ifndef OPENSSL_NO_STDIO 341*4724848cSchristos int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, 342*4724848cSchristos char *kstr, int klen, 343*4724848cSchristos pem_password_cb *cb, void *u); 344*4724848cSchristos int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, 345*4724848cSchristos char *kstr, int klen, 346*4724848cSchristos pem_password_cb *cb, void *u); 347*4724848cSchristos int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, 348*4724848cSchristos char *kstr, int klen, 349*4724848cSchristos pem_password_cb *cb, void *u); 350*4724848cSchristos 351*4724848cSchristos EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, 352*4724848cSchristos void *u); 353*4724848cSchristos 354*4724848cSchristos int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, 355*4724848cSchristos char *kstr, int klen, pem_password_cb *cd, 356*4724848cSchristos void *u); 357*4724848cSchristos # endif 358*4724848cSchristos EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x); 359*4724848cSchristos int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x); 360*4724848cSchristos 361*4724848cSchristos # ifndef OPENSSL_NO_DSA 362*4724848cSchristos EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length); 363*4724848cSchristos EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length); 364*4724848cSchristos EVP_PKEY *b2i_PrivateKey_bio(BIO *in); 365*4724848cSchristos EVP_PKEY *b2i_PublicKey_bio(BIO *in); 366*4724848cSchristos int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk); 367*4724848cSchristos int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk); 368*4724848cSchristos # ifndef OPENSSL_NO_RC4 369*4724848cSchristos EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u); 370*4724848cSchristos int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, 371*4724848cSchristos pem_password_cb *cb, void *u); 372*4724848cSchristos # endif 373*4724848cSchristos # endif 374*4724848cSchristos 375*4724848cSchristos # ifdef __cplusplus 376*4724848cSchristos } 377*4724848cSchristos # endif 378*4724848cSchristos #endif 379