summaryrefslogtreecommitdiffstats
path: root/pica-client/main.cpp
diff options
context:
space:
mode:
authorme_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac>2013-10-11 20:53:36 +0000
committerme_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac>2013-10-11 20:53:36 +0000
commitb09a0605693b0a350f4ee1a08896d638ebdd23ef (patch)
tree372199dad42e5245370dfd0a01909c5326ec81b7 /pica-client/main.cpp
parent56c1e5aacaaec79b24453d406e7c2b218fa0cc9f (diff)
downloadpica-pica-b09a0605693b0a350f4ee1a08896d638ebdd23ef.tar.gz
pica-pica-b09a0605693b0a350f4ee1a08896d638ebdd23ef.zip
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
Diffstat (limited to 'pica-client/main.cpp')
-rw-r--r--pica-client/main.cpp39
1 files changed, 37 insertions, 2 deletions
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 <QMessageBox>
#include <QString>
#include <QIcon>
-#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;