From f44ab3ec6d7e91e2aa08498621822fc416990c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Thu, 21 Apr 2011 06:17:04 +0000 Subject: [PATCH] cleanup old stuff; refs #32 --- swisssurfer/src/qmake.pro.in | 2 +- swisssurfer/src/smartcardauth.cxx | 124 ------------------------------ 2 files changed, 1 insertion(+), 125 deletions(-) delete mode 100644 swisssurfer/src/smartcardauth.cxx diff --git a/swisssurfer/src/qmake.pro.in b/swisssurfer/src/qmake.pro.in index 0c4cb3a..95f1395 100644 --- a/swisssurfer/src/qmake.pro.in +++ b/swisssurfer/src/qmake.pro.in @@ -20,7 +20,7 @@ TRANSLATIONS = @PACKAGENAME@_en.ts \ @PACKAGENAME@_fr.ts \ @PACKAGENAME@_it.ts -SOURCES = main.cxx smartcardauth.cxx webpage.cxx +SOURCES = main.cxx webpage.cxx HEADERS = browser.hxx smartcardauth.hxx pinentry.hxx \ downloadmanager.hxx settings.hxx sslclientnetworkmanager.hxx \ diff --git a/swisssurfer/src/smartcardauth.cxx b/swisssurfer/src/smartcardauth.cxx deleted file mode 100644 index 3feb9f6..0000000 --- a/swisssurfer/src/smartcardauth.cxx +++ /dev/null @@ -1,124 +0,0 @@ -#include "smartcardauth.hxx" -#include "pindialog.hxx" - -#include "engine_sct.h" - -#include -#include -#include - -#include -#include -#include -/* -std::map sockets; - -int client_cert_cb(SSL* ssl, X509 **x509, EVP_PKEY **pkey) { - - // NB: Keep in mind that this function is called for EVERY SSL connection to be opened. - - for(size_t i=certs_found->num_certs;i--;) - { - const char *id_p = certs_found->certificate[i].id; - - if(id_p == NULL) continue; - - // 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:"<certificate[i].cert); - *pkey = NULL; - - // If we don't have a PIN yet, pop up a dialog, ask for a PIN and pass it along to the engine - // for usage. - if(!pin_configured) - { - PinDialog dlg; - int ok=dlg.exec(); - if(ok!=1) {_mutex.unlock(); return 0;} // User cancelled - QByteArray pinByteArray=dlg.pin().toAscii(); - char *pin_str = pinByteArray.data(); - - // The engine control command takes a copy and overwrites the source array - if(ENGINE_ctrl_cmd_string(e, "PIN", pin_str, 0)) - pin_configured = true; - else - {_mutex.unlock(); return 0;} // Engine refuses to take the PIN - - *pkey = ENGINE_load_private_key(e, id_p, NULL, NULL); - - // We do a test authorization on loading of the private key. If the operation fails at all, - // DON'T try again (see below) or we would instantly lock the card in a single session because - // of the retries! - if(!*pkey) - pin_rejected = true; - } - - // Second to nth iteration: We skipped the PIN dialog here, now load the key if we don't have the - // explicit information not to do it (because the PIN is wrong) - if(!*pkey && !pin_rejected) - *pkey = ENGINE_load_private_key(e, id_p, NULL, NULL); - - break; - } - - if(!*x509) { - qWarning("Unable to load certificate"); - _mutex.unlock(); - return 0; - } - - if(!*pkey) { - qWarning("Unable to load key"); - _mutex.unlock(); - return 0; - } - - _mutex.unlock(); - return 1; -} -/* -/* -void SmartCardAuth::extendedContextInitialization(ssl_ctx_st *ctx, - QSslSocket *socket) -{ - if (!e) return; - bool result = false; - - if(!certs_found) - result = (ENGINE_ctrl_cmd(e, "ENUM_CERTS", 0, &certs_found, NULL, 0) != 0); - else - result = true; - -#ifdef USE_CERTIFICATE_FILE - // Load a specific intermediate certificate from a file - //! @todo PEM-File - BIO* cert_file= BIO_new_file("swsign_interm.pem", "r"); - X509* interm=PEM_read_bio_X509(cert_file,NULL,NULL, NULL); - BIO_free(cert_file); - - SSL_CTX_add_extra_chain_cert(ctx,interm); -#else - // Add all of the card's certificates without a private key as intermediate certs - for(size_t i=certs_found->num_certs;i--;) - { - if(certs_found->certificate[i].id == NULL) - SSL_CTX_add_extra_chain_cert(ctx, X509_dup(certs_found->certificate[i].cert)); - } -#endif - - sockets[ctx] = socket; - SSL_CTX_set_client_cert_cb(ctx, client_cert_cb); -} - */