From b09a0605693b0a350f4ee1a08896d638ebdd23ef Mon Sep 17 00:00:00 2001 From: me_desk Date: Fri, 11 Oct 2013 20:53:36 +0000 Subject: better handling of DH parameter generation - added new class DHParam, default DH param file dhparam4096.pem git-svn-id: svn://localhost/project_picapica/trunk@277 fb96df88-216d-11de-830c-f3023f12d8ac --- pica-client/main.cpp | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'pica-client/main.cpp') diff --git a/pica-client/main.cpp b/pica-client/main.cpp index ecca274..5fbd0af 100644 --- a/pica-client/main.cpp +++ b/pica-client/main.cpp @@ -11,8 +11,8 @@ #include #include #include -#include "openssltool.h" #include "../PICA_client.h" +#include "dhparam.h" //globals QString config_dir; @@ -32,8 +32,10 @@ class PicaSysTray *systray; //QString config_defaultCA("/home/root_jr/files/projects/picapica_wc/localhost/project_picapica/trunk/tests/trusted_CA.pem"); #ifndef WIN32 QString config_defaultCA(PICA_INSTALLPREFIX"/share/pica-client/CA.pem"); +QString config_defaultDHParam(PICA_INSTALLPREFIX"/share/pica-client/"PICA_CLIENT_DHPARAMFILE); #else QString config_defaultCA("share\\CA.pem"); +QString config_defaultDHParam("share\\pica-client\\"PICA_CLIENT_DHPARAMFILE); #endif static bool create_database() @@ -390,7 +392,7 @@ static bool create_config_dir() else update_database(); - if (!QFile::exists(config_dir + QDir::separator() + PICA_CLIENT_DHPARAMFILE)) + /*if (!QFile::exists(config_dir + QDir::separator() + PICA_CLIENT_DHPARAMFILE)) { OpenSSLTool osslt; msgBox.setText(QString(QObject::tr("Diffie-Hellman parameters will be generated. Please wait. This process can take several minutes..."))); @@ -402,6 +404,39 @@ static bool create_config_dir() msgBox.exec(); return false; } + }*/ + + QString dh_error_message; + + if (!DHParam::VerifyGenerated(NULL)) + { + QMessageBox dhmsgBox; + dhmsgBox.setText(QObject::tr("Do you want to generate new Diffie-Hellman parameter file?")); + dhmsgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); + dhmsgBox.setDefaultButton(QMessageBox::No); + dhmsgBox.setInformativeText(QObject::tr("If you press \"Yes\", new Diffie-Hellman parameter generation will be started. It is a CPU intensive process and can take undetermined amount of time (1 - 20 minutes on modern computers). Default DH parameter file will be used for starting secure communications until the new DH parameter generation is finished.\nIf you press \"No\", default DH parameter file distributed with Pica Pica Messenger will be used for every communication session.")); + switch (dhmsgBox.exec()) + { + case QMessageBox::No: + + DHParam::UseDefault(); + + break; + + case QMessageBox::Yes: + + DHParam::StartNewDHParamGeneration(&dh_error_message); + + break; + } + + if (!DHParam::VerifyDefault(&dh_error_message)) + { + msgBox.setText(dh_error_message); + msgBox.setIcon(QMessageBox::Warning); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.exec(); + } } return true; -- cgit v1.2.1