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,11 +6,54 @@
#include <iostream>
#include "smartcardauth.h"
#include <openssl/engine.h>
#define CHECK(X) \
if (((!(((res=X)))))) { \
printf("ERROR: %s\n", #X); \
for (unsigned int err(0); err=ERR_get_error();) { \
fprintf(stderr,"%s\n", ERR_error_string(err, NULL)); \
} \
return -1; \
}
SmartCardAuth g_scard_auth;
int main(int argc, char *argv[])
{
/*
ENGINE* e = NULL;
enum_certs_s* certs_found = NULL;
ENGINE_load_dynamic();
e = ENGINE_by_id("dynamic");
if (!e) {
printf("ERROR: No Engine");
return -1;
}
int res(-1);
// Parameters to set for the dynamic loader
CHECK(ENGINE_ctrl_cmd_string(e, "SO_PATH", "./.libs/libengine_act.so", 0));
CHECK(ENGINE_ctrl_cmd_string(e, "ID", "act", 0));
CHECK(ENGINE_ctrl_cmd_string(e, "LIST_ADD", "1", 0));
// Now actually load the SecureToken engine.
CHECK(ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0)
|| ENGINE_ctrl_cmd_string(e, "SO_PATH", "./src/.libs/libengine_act.so", 0)
&& ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0)
|| ENGINE_ctrl_cmd_string(e, "SO_PATH", "../openssl-act-engine/src/.libs/libengine_act.so", 0)
&& ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0));
// Following control commands go to the SecureToken engine rather than the dynamic loader
CHECK(ENGINE_init(e));
return 0;
*/
SmartCardAuth::initialize();
QApplication app(argc, argv);
@@ -20,7 +63,7 @@ int main(int argc, char *argv[])
// Works even without specifying the root certificate, we just need to add the intermediates,
// and that's done in SmartCardAuth.cpp
#if 0
QFile caCertsFile("D:\\QtSmartCardAuth_TMI\\QtSslTest\\swsign_root.pem");
QFile caCertsFile("swsign_root.pem");
caCertsFile.open(QIODevice::ReadOnly);
QList<QSslCertificate> chain( QSslCertificate::fromDevice(&caCertsFile) );