RE: rsa certificate and private key question

2005-12-21 Thread Mark
Hi, 

 by using the following openssl cli, i generate a rsa private 
 key key and a self signed certificate file.
 
 $ openssl genrsa -out key.pem 1024
 $ openssl req -new -key key.pem -out request.pem
 $ openssl x509 -req -days 30 -in request.pem -signkey key.pem 
 -out certificate.pem
 
 when i try to load the key file and certificate file to my 
 ssl context, both 
 SSL_CTX_use_certificate_file(ctx,keyfile,SSL_FILETYPE_PEM) and
 SSL_CTX_use_PrivateKey_file(ctx,keyfile,SSL_FILETYPE_PEM)
 returns 1. 

I'm not an expert but I think you need to use certificate.pem in
your call to SSL_CTX_use_certificate_file()

 however, when i use
 SSL_CTX_check_private_key(ctx)
 to check if the key matchs the certificate, this function returns 0.

Check the error queue.  This should contain the reason for the error.

Best Regards,
Mark Williams   Tech OP ltd
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


rsa certificate and private key question

2005-12-20 Thread Chong Peng
dear all:

by using the following openssl cli, i generate a rsa private key key and a self 
signed certificate file.

$ openssl genrsa -out key.pem 1024
$ openssl req -new -key key.pem -out request.pem
$ openssl x509 -req -days 30 -in request.pem -signkey key.pem -out 
certificate.pem

when i try to load the key file and certificate file to my ssl context, both 
SSL_CTX_use_certificate_file(ctx,keyfile,SSL_FILETYPE_PEM) and
SSL_CTX_use_PrivateKey_file(ctx,keyfile,SSL_FILETYPE_PEM)
returns 1. 

however, when i use
SSL_CTX_check_private_key(ctx)
to check if the key matchs the certificate, this function returns 0.

what could be wrong here? it seems these are all standard simple operations.
thanks a lot.

chong peng
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]