it works; closes #8

This commit is contained in:
Marc Wäckerlin
2011-01-13 07:08:40 +00:00
parent 1d0ba31114
commit cd84f2f7fe
22 changed files with 638 additions and 207 deletions

View File

@@ -6,6 +6,8 @@
#include <string>
#include <QtCore/QDebug>
ENGINE* SmartCardAuth::e=NULL;
enum_certs_s* SmartCardAuth::certs_found=NULL;
QWidget* SmartCardAuth::parent=0;
@@ -13,16 +15,20 @@ bool SmartCardAuth::pin_configured=false;
bool SmartCardAuth::pin_rejected=false;
void SmartCardAuth::initialize() {
QSslSocketPrivate::ensureInitialized();
//QSslSocketPrivate::ensureInitialized();
q_ENGINE_load_dynamic();
e = q_ENGINE_by_id("dynamic");
ENGINE_load_dynamic();
e = ENGINE_by_id("dynamic");
Q_ASSERT(e);
//! @todo add library-name
int r=q_ENGINE_ctrl_cmd_string(e, "SO_PATH", "...library-name...", 0);
r=q_ENGINE_ctrl_cmd_string(e, "ID", "act", 0);
r=q_ENGINE_ctrl_cmd_string(e, "LIST_ADD", "1", 0);
r=q_ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0);
int r=ENGINE_ctrl_cmd_string(e, "SO_PATH", "../openssl-act-engine/src/.libs/libengine_act.so", 0);
Q_ASSERT(r);
r=ENGINE_ctrl_cmd_string(e, "ID", "act", 0);
Q_ASSERT(r);
r=ENGINE_ctrl_cmd_string(e, "LIST_ADD", "1", 0);
Q_ASSERT(r);
r=ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0);
Q_ASSERT(r);
if(!r)
{
@@ -34,7 +40,7 @@ void SmartCardAuth::initialize() {
}
}
r=q_ENGINE_init(e);
r=ENGINE_init(e);
}
@@ -59,6 +65,7 @@ int SmartCardAuth::client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey)
// Name has the format "slot-x-name-SwissSign_digSig" for the certificate/key we're looking for
std::string name(certs_found->certificate[i].name);
qDebug()<<"Certificate:"<<name.c_str();
std::string compare("-name-SwissSign_digSig");
// Compare the rightmost part of the retrieved name to locate the certificate/keypair