when i use PEM_read_PrivateKey find it work error ,so i look into
PEM_read_PrivateKey to find the reason.
first i find in
#define PEM_read_PrivateKey(fp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read( \
(char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,fp,(char **)x,cb,u)
next i find in
void *PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x,
pem_password_cb *cb, void *u)
{
BIO *b;
void *ret;
if ((b=BIO_new(BIO_s_file())) == NULL)
{
PEMerr(PEM_F_PEM_ASN1_READ,ERR_R_BUF_LIB);
return(0);
}
BIO_set_fp(b,fp,BIO_NOCLOSE);
ret=PEM_ASN1_read_bio(d2i,name,b,x,cb,u);
BIO_free(b);
return(ret);
}
then i goto
void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void
**x,
pem_password_cb *cb, void *u)
{
const unsigned char *p=NULL;
unsigned char *data=NULL;
long len;
char *ret=NULL;
if (!PEM_bytes_read_bio(&data, &len, NULL, name, bp, cb, u))
return NULL;
p = data;
ret=d2i(x,&p,len);
if (ret == NULL)
PEMerr(PEM_F_PEM_ASN1_READ_BIO,ERR_R_ASN1_LIB);
OPENSSL_free(data);
return(ret);
}
i found the ret=d2i(x,&p,len);
but the function is
EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
long length)
i think d2i must have 4 parameter but is only three,why? Thanks a lot!
_________________________________________________________________
免费下载 MSN Explorer: http://explorer.msn.com/lccn/
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager [EMAIL PROTECTED]