Hi,
I have a problem when I try load a private key from a
PEM-format key file:
The private key and certificate are both exported and
converted from Verisign's free Personal ID (which is installed into IE
5).
My load_key function is :
.......
static EVP_PKEY *load_key(char *key_file, int
format)
{ BIO *key=NULL; EVP_PKEY *pkey=NULL; key=BIO_new(BIO_s_file());
if (key == NULL)
{ .... } if (BIO_read_filename(key,key_file) <= 0) { .... }
if (format == FORMAT_PEM) { pkey=PEM_read_bio_PrivateKey(key,NULL,NULL,NULL); } ................... if (key != NULL)
BIO_free(key);
return(pkey); } ...... When it is called, pkey is always return NULL.
And When I use the private and certificate to make SSL
connection, everything works well.
// Register a certificate from Cert file
if (SSL_CTX_use_certificate_file(pchSslSupport->sslCtx, certFile, cfType) <= 0) { SslErrorHandler(ERR_SSL_CTX_USE_CERTF_FAILED); return(-1); } // Establish private key from Key file if (SSL_CTX_use_PrivateKey_file(pchSslSupport->sslCtx, keyFile, kfType) <= 0) { SslErrorHandler(ERR_SSL_CTX_USE_PRIKEYF_FAILED); return(-1); } What is wrong??
My private key file looks like :
-----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: DES-EDE3-CBC,C780DCD57F8F0503 ................................................................................................................. -----END RSA PRIVATE KEY----- Any advice is appreciated,
Dennis
|
- Can't load client's private key ? Dennis Xu
- Re: Can't load client's private key ? Dr Stephen Henson
- RE: Can't load client's private key ? Dennis Xu
- RE: Can't load client's private key ? Wade L. Scholine