--- curl-7.19.6/lib/ssluse.c	2009-10-16 14:51:40.288976299 +0000
+++ curl-7.19.6-engine/lib/ssluse.c	2009-10-16 14:55:50.915769426 +0000
@@ -310,9 +310,10 @@
                const char *key_type)
 {
   struct SessionHandle *data = conn->data;
-  int file_type;
 
-  if(cert_file != NULL) {
+  int file_type = do_file_type(cert_type);
+
+  if(cert_file != NULL || file_type == SSL_FILETYPE_ENGINE) {
     SSL *ssl;
     X509 *x509;
     int cert_done = 0;
@@ -337,7 +338,6 @@
       SSL_CTX_set_default_passwd_cb(ctx, passwd_callback);
     }
 
-    file_type = do_file_type(cert_type);
 
 #define SSL_CLIENT_CERT_ERR \
     "unable to use client certificate (no key found or wrong pass phrase?)"
@@ -1507,7 +1507,7 @@
     SSL_CTX_ctrl(connssl->ctx, BIO_C_SET_NBIO, 1, NULL);
 #endif
 
-  if(data->set.str[STRING_CERT]) {
+  if(data->set.str[STRING_CERT] || data->set.str[STRING_CERT_TYPE]) {
     if(!cert_stuff(conn,
                    connssl->ctx,
                    data->set.str[STRING_CERT],
