Hi all,
 
I'm developing a custom Engine in order to have a SSL client dual 
authentication connection.
 
When I try to connect, I got: 
(...)
SSL_connect:SSLv3 flush data
SSL_connect:error in SSLv3 read finished A
error:260C0065:engine routines:ENGINE_get_pkey_meth:unimplemented public key 
methoderror:0609D09C:digital envelope routines:INT_CTX
 
I found here 
(http://openssl.6102.n7.nabble.com/Error-with-quot-dgst-sign-quot-td22420.html) 
that I should call load keys.
 
I'm calling ENGINE_set_load_privkey_function() and 
ENGINE_set_load_pubkey_function() functions and they are not been called.
 
I'm also setting ENGINE_set_default(e,ENGINE_METHOD_RSA) and 
   !ENGINE_set_RSA(e,get_rsa_method()). The encrypting with private key is 
called in handshake.
 
I'm calling ENGINE_set_load_ssl_client_cert_function(), and the callback is 
called. Inside this function:
 
//Cert is got and stored into *pcert ...
*pkey = X509_get_pubkey(*pcert);
 if (*pkey == NULL)
 {
  /* the engine isn't available */
  printf("ssl_client_cert_callback: pkey = NULL\r\n");
  return 0;
 }
 RSA *rsa;
 rsa = RSA_new_method(e);
 RSA_set_method(rsa, ENGINE_get_RSA(e));
 rsa->n = BN_new();
 BN_set_bit(rsa->n,2048);
 EVP_PKEY_set1_RSA(*pkey, rsa);
 (*pkey)->engine = e;

 return 1;

The handshake is done just fine. May anyone help how to set the engine 
correctly? Any example? 

Thanks. 
Leonardo

Reply via email to