diff --git a/retroshare-gui/src/gui/Preferences/CryptographyDialog.cpp b/retroshare-gui/src/gui/Preferences/CryptographyDialog.cpp index 854391b17..bdd6109ed 100644 --- a/retroshare-gui/src/gui/Preferences/CryptographyDialog.cpp +++ b/retroshare-gui/src/gui/Preferences/CryptographyDialog.cpp @@ -1,7 +1,7 @@ /**************************************************************** - * RShare is distributed under the following license: + * RetroShare is distributed under the following license: * - * Copyright (C) 2006, crypton + * Copyright (C) 2006 - 2009 RetroShare Team * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -17,40 +17,120 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. - ****************************************************************/ - - -#include -#include "CryptographyDialog.h" - - -/** Constructor */ -CryptographyDialog::CryptographyDialog(QWidget *parent) -: ConfigPage(parent) -{ - /* Invoke the Qt Designer generated object setup routine */ - ui.setupUi(this); - - /* Create RshareSettings object */ - _settings = new RshareSettings(); - - /* Hide platform specific features */ -#ifdef Q_WS_WIN - -#endif -} - -/** Saves the changes on this page */ -bool -CryptographyDialog::save(QString &errmsg) -{ - -} - -/** Loads the settings for this page */ -void -CryptographyDialog::load() -{ - -} - + ****************************************************************/ + +#include "rsiface/rspeers.h" //for rsPeers variable +#include "rsiface/rsiface.h" + +#include +#include + +#include +#include "CryptographyDialog.h" + +#include +#include +#include + +/** Constructor */ +CryptographyDialog::CryptographyDialog(QWidget *parent) +: ConfigPage(parent) +{ + /* Invoke the Qt Designer generated object setup routine */ + ui.setupUi(this); + + /* Create RshareSettings object */ + _settings = new RshareSettings(); + + connect(ui.copykeyButton, SIGNAL(clicked()), this, SLOT(copyPublicKey())); + connect(ui.exportkeyButton, SIGNAL(clicked()), this, SLOT(exportPublicKey())); + + + loadPublicKey(); + + + /* Hide platform specific features */ +#ifdef Q_WS_WIN + +#endif +} + +/** Saves the changes on this page */ +bool +CryptographyDialog::save(QString &errmsg) +{ + return true; +} + +/** Loads the settings for this page */ +void +CryptographyDialog::load() +{ + +} + +/** Loads ouer default Puplickey */ +void +CryptographyDialog::loadPublicKey() +{ + //std::cerr << "CryptoPage() getting Invite" << std::endl; + + std::string invite = rsPeers->GetRetroshareInvite(); + + RsPeerDetails ownDetail; + rsPeers->getPeerDetails(rsPeers->getOwnId(), ownDetail); + invite += LOCAL_IP; + invite += ownDetail.localAddr + ":"; + std::ostringstream out; + out << ownDetail.localPort; + invite += out.str() + ";"; + invite += "\n"; + invite += EXT_IP; + invite += ownDetail.extAddr + ":"; + std::ostringstream out2; + out2 << ownDetail.extPort; + invite += out2.str() + ";"; + + ui.certtextEdit->setText(QString::fromStdString(invite)); + ui.certtextEdit->setReadOnly(true); + ui.certtextEdit->setMinimumHeight(200); + + //std::cerr << "CryptoPage() getting Invite: " << invite << std::endl; + +} + +void +CryptographyDialog::copyPublicKey() +{ + QMessageBox::information(this, + tr("RetroShare"), + tr("Your Public Key is copied to Clipbard, paste and send it to your" + "friend via email or some other way")); + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setText(ui.certtextEdit->toPlainText()); + +} + +void +CryptographyDialog::exportPublicKey() +{ + qDebug() << " exportPulicKey"; + + QString qdir = QFileDialog::getSaveFileName(this, + "Please choose a filename", + QDir::homePath(), + "RetroShare Certificate (*.pqi)"); + + if ( rsPeers->SaveCertificateToFile(rsPeers->getOwnId(), qdir.toStdString()) ) + { + QMessageBox::information(this, tr("RetroShare"), + tr("Certificate file successfully created"), + QMessageBox::Ok, QMessageBox::Ok); + } + else + { + QMessageBox::information(this, tr("RetroShare"), + tr("Sorry, certificate file creation failed"), + QMessageBox::Ok, QMessageBox::Ok); + } +} diff --git a/retroshare-gui/src/gui/Preferences/CryptographyDialog.h b/retroshare-gui/src/gui/Preferences/CryptographyDialog.h index 62696ce84..53b141adc 100644 --- a/retroshare-gui/src/gui/Preferences/CryptographyDialog.h +++ b/retroshare-gui/src/gui/Preferences/CryptographyDialog.h @@ -1,7 +1,7 @@ /**************************************************************** - * RShare is distributed under the following license: + * RetroShare is distributed under the following license: * - * Copyright (C) 2006, crypton + * Copyright (C) 2006 - 2009 RetroShare Team * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -17,42 +17,50 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. - ****************************************************************/ - + ****************************************************************/ + #ifndef _CRYPTOGRAPHYDIALOG_H -#define _CRYPTOGRAPHYDIALOG_H - +#define _CRYPTOGRAPHYDIALOG_H + #include -#include - -#include "configpage.h" -#include "ui_CryptographyDialog.h" - -class CryptographyDialog : public ConfigPage -{ - Q_OBJECT - -public: - /** Default Constructor */ - CryptographyDialog(QWidget *parent = 0); - /** Default Destructor */ - - /** Saves the changes on this page */ - bool save(QString &errmsg); - /** Loads the settings for this page */ - void load(); - -private slots: - - -private: - /** A RshareSettings object used for saving/loading settings */ +#include +#include "gui/connect/ConnectFriendWizard.h" + +#include "configpage.h" +#include "ui_CryptographyDialog.h" + + +class CryptographyDialog : public ConfigPage +{ + Q_OBJECT + +public: + /** Default Constructor */ + CryptographyDialog(QWidget *parent = 0); + /** Default Destructor */ + + /** Saves the changes on this page */ + bool save(QString &errmsg); + /** Loads the settings for this page */ + void load(); + +private slots: + + void loadPublicKey(); + + void copyPublicKey(); + + void exportPublicKey(); + + +private: + /** A RshareSettings object used for saving/loading settings */ RshareSettings* _settings; - - /** Qt Designer generated object */ - Ui::CryptographyDialog ui; -}; - -#endif - + + /** Qt Designer generated object */ + Ui::CryptographyDialog ui; +}; + +#endif + diff --git a/retroshare-gui/src/gui/Preferences/CryptographyDialog.ui b/retroshare-gui/src/gui/Preferences/CryptographyDialog.ui index 32dc36e96..f1ced29e3 100644 --- a/retroshare-gui/src/gui/Preferences/CryptographyDialog.ui +++ b/retroshare-gui/src/gui/Preferences/CryptographyDialog.ui @@ -1,172 +1,171 @@ - + + CryptographyDialog - - + + 0 0 - 617 - 332 + 542 + 355 - - - 7 - 7 + + 0 0 - + - - - + + + 0 0 0 - - - + + + 208 208 208 - - - + + + 255 255 255 - - - + + + 247 247 247 - - - + + + 104 104 104 - - - + + + 139 139 139 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 240 240 240 - - - + + + 0 0 0 - - - + + + 0 0 128 - - - + + + 255 255 255 - - - + + + 0 0 255 - - - + + + 255 0 255 - - - + + + 231 231 231 @@ -175,153 +174,153 @@ - - - + + + 0 0 0 - - - + + + 208 208 208 - - - + + + 255 255 255 - - - + + + 247 247 247 - - - + + + 104 104 104 - - - + + + 139 139 139 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 240 240 240 - - - + + + 0 0 0 - - - + + + 192 192 192 - - - + + + 0 0 0 - - - + + + 0 0 255 - - - + + + 255 0 255 - - - + + + 231 231 231 @@ -330,153 +329,153 @@ - - - + + + 104 104 104 - - - + + + 208 208 208 - - - + + + 255 255 255 - - - + + + 247 247 247 - - - + + + 104 104 104 - - - + + + 139 139 139 - - - + + + 104 104 104 - - - + + + 255 255 255 - - - + + + 104 104 104 - - - + + + 240 240 240 - - - + + + 240 240 240 - - - + + + 0 0 0 - - - + + + 0 0 128 - - - + + + 255 255 255 - - - + + + 0 0 255 - - - + + + 255 0 255 - - - + + + 231 231 231 @@ -486,7 +485,7 @@ - + Arial 8 @@ -497,442 +496,95 @@ false - + Qt::NoContextMenu - - - - 0 - 0 - 611 - 51 - - - - RSA Key Size - - - - - 10 - 20 - 54 - 25 - - - - Key Size: - - - - - - 120 - 20 - 481 - 23 - - - - 16384 - - - 384 - - - 1024 - - - - - - - 0 - 200 - 611 - 51 - - - - Rijndael Mode - - - - - 120 - 20 - 83 - 18 - - - - CBC - - - - - - 210 - 20 - 71 - 18 - - - - ECB - - - - - - 300 - 20 - 83 - 18 - - - - CFB - - - - - - 10 - 20 - 61 - 25 - - - - Mode: - - - - - - - 0 - 250 - 611 - 51 - - - - Rijndael Padding - - - - - 120 - 20 - 83 - 18 - - - - PKCS7 - - - - - - 210 - 20 - 83 - 18 - - - - Zeros - - - - - - 300 - 20 - 83 - 18 - - - - ANSIX923 - - - - - - 400 - 20 - 83 - 18 - - - - ISO10126 - - - - - - 10 - 20 - 61 - 25 - - - - Padding: - - - - - - - 0 - 100 - 611 - 51 - - - - Rijndael Feedback Size - - - - - 120 - 20 - 83 - 18 - - - - 128 Bits - - - - - - 210 - 20 - 83 - 18 - - - - 192 Bits - - - - - - 300 - 20 - 83 - 18 - - - - 256 Bits - - - - - - 10 - 20 - 82 - 25 - - - - Feedback Size: - - - - - - - 0 - 50 - 611 - 51 - - - - Rijndael Block size - - - - - 120 - 20 - 83 - 18 - - - - 128 Bits - - - - - - 230 - 50 - 83 - 18 - - - - 192 Bits - - - - - - 240 - 60 - 83 - 18 - - - - 192 Bits - - - - - - 210 - 20 - 83 - 18 - - - - 192 Bits - - - - - - 300 - 20 - 83 - 18 - - - - 256 Bits - - - - - - 10 - 20 - 61 - 25 - - - - Block Size: - - - - - - - 0 - 150 - 611 - 51 - - - - Rijndael Key Size - - - - - 120 - 20 - 83 - 18 - - - - 128 Bits - - - - - - 300 - 20 - 83 - 18 - - - - 256 Bits - - - - - - 210 - 20 - 83 - 18 - - - - 192 Bits - - - - - - 10 - 20 - 54 - 25 - - - - Key Size: - - - + + + + + + + Public Key + + + + + + + + + + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Export my Key as file</p></body></html> + + + Export Key + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Copy my Key to Clipboard</p></body></html> + + + Copy Key + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + + Qt::Vertical + + + + 58 + 298 + + + + + + + + + - - spinBoxkeysize - radioButton - radioButton_4 - radioButton_9 - radioButton_2 - radioButton_5 - radioButton_10 - radioButton_3 - radioButton_6 - radioButton_11 - radioButton_12 - radioButton_13 - radioButton_14 - radioButton_15 - radioButton_16 - radioButton_17 - radioButton_18 - radioButton_8 - radioButton_7 - - + diff --git a/retroshare-gui/src/gui/Preferences/PreferencesWindow.cpp b/retroshare-gui/src/gui/Preferences/PreferencesWindow.cpp index 1602494c1..bc958455c 100644 --- a/retroshare-gui/src/gui/Preferences/PreferencesWindow.cpp +++ b/retroshare-gui/src/gui/Preferences/PreferencesWindow.cpp @@ -32,12 +32,12 @@ /* Images for toolbar icons */ #define IMAGE_PREFERENCES ":/images/kcmsystem24.png" -#define IMAGE_SERVER ":/images/server_24x24.png" -#define IMAGE_DIRECTORIES ":/images/folder_doments.png" -#define IMAGE_CRYPTOGRAPHY ":/images/cryptography_24x24.png" -#define IMAGE_LOG ":/images/log_24x24.png" -#define IMAGE_ABOUT ":/images/informations_24x24.png" -#define IMAGE_SAVE ":/images/media-floppy.png" +#define IMAGE_SERVER ":/images/server_24x24.png" +#define IMAGE_DIRECTORIES ":/images/folder_doments.png" +#define IMAGE_CRYPTOGRAPHY ":/images/encrypted32.png" +#define IMAGE_LOG ":/images/log_24x24.png" +#define IMAGE_ABOUT ":/images/informations_24x24.png" +#define IMAGE_SAVE ":/images/media-floppy.png" #define IMAGE_HELP ":/images/help24.png" #define IMAGE_APPEARRANCE ":/images/looknfeel.png" #define IMAGE_FILE_ASSOTIATIONS ":/images/folder-draft24.png" @@ -69,6 +69,9 @@ PreferencesWindow::PreferencesWindow(QWidget *parent, Qt::WFlags flags) ui.stackPages->add(new NotifyDialog(ui.stackPages), createPageAction(QIcon(IMAGE_NOTIFY), tr("Notify"), grp)); + ui.stackPages->add(new CryptographyDialog(ui.stackPages), + createPageAction(QIcon(IMAGE_CRYPTOGRAPHY), tr("Security"), grp)); + ui.stackPages->add(new FileAssotiationsDialog(ui.stackPages), createPageAction(QIcon(IMAGE_FILE_ASSOTIATIONS), tr("File assotiations"), grp)); diff --git a/retroshare-gui/src/gui/Preferences/PreferencesWindow.h b/retroshare-gui/src/gui/Preferences/PreferencesWindow.h index f21ba56a2..337ebc747 100644 --- a/retroshare-gui/src/gui/Preferences/PreferencesWindow.h +++ b/retroshare-gui/src/gui/Preferences/PreferencesWindow.h @@ -50,6 +50,7 @@ public: Directories, /** Directories page. */ Appearance, /** Appearance page. */ Notify, /** Notify page. */ + Security, /** Security page. */ FileAssotiations /** File assotiations page. */ };