Try SSL_CTX_use_PrivateKey_file() to load private key
(and I suggest SSL_CTX_check_private_key() to check
private key to certificate compatibility).

Well, I thought for PEM SSL_CTX_use_certificate_chain_file() would
also load the private key (thought I read that somewhere) ...anway.
When I use  SSL_CTX_use_PrivateKey_file() the callback is now getting
called and passes on the password. The return code is ok.

After that I now also check with SSL_CTX_check_private_key() with also
returns a success

     SSL_CTX_set_default_passwd_cb_userdata(ssl_ctx, MYPASSWORD);
     SSL_CTX_set_default_passwd_cb(ssl_ctx, passwd_callback);

     if(SSL_CTX_use_certificate_chain_file(ssl_ctx,
"/home/torsten/torsten.pem") != 1) {
         fprintf(stderr, "Failed loading certificate\n");
     }

     if(SSL_CTX_use_PrivateKey_file(ssl_ctx,
"/home/torsten/torsten.pem", SSL_FILETYPE_PEM) != 1) {
         fprintf(stderr, "Failed loading private key\n");
     }

     if(SSL_CTX_check_private_key(ssl_ctx) != 1) {
         fprintf(stderr, "Could not verify private key\n");
     }

But it still fails on the connect the same way :-(

> But on a connect
>
>       ssl_err = SSL_connect(hr->ssl);
>       if (ssl_err < 0)
>       {
>         error_printf("Hard error %d on SSL_connect for fd %d\n",
> ssl_err, event->fd);
>
> I always get a -1 return code and the password callback is not getting
> called at all
Add ERR_print_errors_fp(stderr); to get more information.

I've added that after the SSL_connect call but I don't see any further
information getting printed.

Ideas?

cheers
--
Torsten
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to