Custom Engine

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Custom Engine

Leo Leo
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'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