new gui elements for encryption
This commit is contained in:
@@ -143,6 +143,7 @@ FORMS += \
|
|||||||
src/requestContactDialog.ui \
|
src/requestContactDialog.ui \
|
||||||
src/newrecurring.ui \
|
src/newrecurring.ui \
|
||||||
src/requestdialog.ui \
|
src/requestdialog.ui \
|
||||||
|
src/removeencryption.ui \
|
||||||
src/recurringmultiple.ui \
|
src/recurringmultiple.ui \
|
||||||
src/chatbubbleme.ui \
|
src/chatbubbleme.ui \
|
||||||
src/chatbubblepartner.ui
|
src/chatbubblepartner.ui
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<item row="1" column="0" colspan="3">
|
<item row="1" column="0" colspan="3">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p><span style=" font-size:14pt; color:#ef2929;">WARNING:</span> If you forget your password, the only way to recover the wallet is from the seed phrase. If you dont have Backup your seed phrase, please do it now!</p></body></html></string>
|
<string><html><head/><body><p><span style=" font-size:14pt; color:#ef2929;">WARNING:</span> If you forget your passphrase the only way to recover the wallet is from the seed phrase. If you dont have Backup your seed phrase, please do it now!</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
<item row="4" column="2" rowspan="2">
|
<item row="4" column="2" rowspan="2">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p>10 letters minimum</p></body></html></string>
|
<string><html><head/><body><p>16 letters minimum</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
<string notr="true">color: red;</string>
|
<string notr="true">color: red;</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Passwords don't match</string>
|
<string>Passphrase don't match</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
<item row="6" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Encryption Password:</string>
|
<string>Encryption Passphrase:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
<item row="7" column="0">
|
<item row="7" column="0">
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Confirm Password:</string>
|
<string>Confirm Passphrase:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -21,7 +21,8 @@
|
|||||||
#include "ui_requestContactDialog.h"
|
#include "ui_requestContactDialog.h"
|
||||||
#include "chatmodel.h"
|
#include "chatmodel.h"
|
||||||
#include "requestdialog.h"
|
#include "requestdialog.h"
|
||||||
#include "ui_startupencryption.h"
|
#include "ui_startupencryption.h"
|
||||||
|
#include "ui_removeencryption.h"
|
||||||
#include "websockets.h"
|
#include "websockets.h"
|
||||||
#include "sodium.h"
|
#include "sodium.h"
|
||||||
#include "sodium/crypto_generichash_blake2b.h"
|
#include "sodium/crypto_generichash_blake2b.h"
|
||||||
@@ -268,18 +269,16 @@ void MainWindow::closeEvent(QCloseEvent* event) {
|
|||||||
if(fileExists(QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath(".silentdragonlite/silentdragonlite-wallet-enc.dat")))
|
if(fileExists(QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath(".silentdragonlite/silentdragonlite-wallet-enc.dat")))
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// delete old file before
|
// delete old file before
|
||||||
|
|
||||||
auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
|
auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
|
||||||
QFile file1(dirHome.filePath(".silentdragonlite/silentdragonlite-wallet-enc.dat"));
|
QFile fileoldencryption(dirHome.filePath(".silentdragonlite/silentdragonlite-wallet-enc.dat"));
|
||||||
file1.remove();
|
fileoldencryption.remove();
|
||||||
|
|
||||||
// Encrypt our wallet.dat
|
// Encrypt our wallet.dat
|
||||||
QString str = "123";///just for testing. We set the user pw here
|
QString str = "123";///just for testing. We set the user pw here
|
||||||
// QString str = ed.txtPassword->text(); // data comes from user inputs
|
// QString str = ed.txtPassword->text(); // data comes from user inputs
|
||||||
int length = str.length();
|
int length = str.length();
|
||||||
|
|
||||||
char *sequence = NULL;
|
char *sequence = NULL;
|
||||||
sequence = new char[length+1];
|
sequence = new char[length+1];
|
||||||
@@ -309,7 +308,7 @@ void MainWindow::closeEvent(QCloseEvent* event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||||
// auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
|
// auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
|
||||||
QString source_file = dir.filePath("addresslabels.dat");
|
QString source_file = dir.filePath("addresslabels.dat");
|
||||||
QString target_enc_file = dir.filePath("addresslabels.dat.enc");
|
QString target_enc_file = dir.filePath("addresslabels.dat.enc");
|
||||||
QString sourceWallet_file = dirHome.filePath(".silentdragonlite/silentdragonlite-wallet.dat");
|
QString sourceWallet_file = dirHome.filePath(".silentdragonlite/silentdragonlite-wallet.dat");
|
||||||
@@ -318,14 +317,16 @@ void MainWindow::closeEvent(QCloseEvent* event) {
|
|||||||
FileEncryption::encrypt(target_enc_file, source_file, key);
|
FileEncryption::encrypt(target_enc_file, source_file, key);
|
||||||
FileEncryption::encrypt(target_encWallet_file, sourceWallet_file, key);
|
FileEncryption::encrypt(target_encWallet_file, sourceWallet_file, key);
|
||||||
|
|
||||||
}
|
///////////////// we rename the plaintext wallet.dat to Backup, for testing.
|
||||||
///////////////// we rename the plaintext wallet.dat to Backup, for testing.
|
|
||||||
auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
|
QFile fileoldbackup(dirHome.filePath(".silentdragonlite/silentdragonlite-wallet.datBACKUP"));
|
||||||
QFile file1(dirHome.filePath(".silentdragonlite/silentdragonlite-wallet.datBACKUP"));
|
fileoldbackup.remove();
|
||||||
file1.remove();
|
|
||||||
QFile file(dirHome.filePath(".silentdragonlite/silentdragonlite-wallet.dat"));
|
QFile file(dirHome.filePath(".silentdragonlite/silentdragonlite-wallet.dat"));
|
||||||
file.rename(dirHome.filePath(".silentdragonlite/silentdragonlite-wallet.datBACKUP"));
|
file.rename(dirHome.filePath(".silentdragonlite/silentdragonlite-wallet.datBACKUP"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Bubble up
|
// Bubble up
|
||||||
if (event)
|
if (event)
|
||||||
QMainWindow::closeEvent(event);
|
QMainWindow::closeEvent(event);
|
||||||
@@ -351,11 +352,11 @@ void MainWindow::encryptWallet() {
|
|||||||
// Enable the OK button if the passwords match.
|
// Enable the OK button if the passwords match.
|
||||||
QString password = ed.txtPassword->text();
|
QString password = ed.txtPassword->text();
|
||||||
if (!ed.txtPassword->text().isEmpty() &&
|
if (!ed.txtPassword->text().isEmpty() &&
|
||||||
ed.txtPassword->text() == ed.txtConfirmPassword->text() && password.size() >= 10) {
|
ed.txtPassword->text() == ed.txtConfirmPassword->text() && password.size() >= 16) {
|
||||||
ed.lblPasswordMatch->setText("");
|
ed.lblPasswordMatch->setText("");
|
||||||
ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
ed.lblPasswordMatch->setText(tr("Passwords don't match or You have entered too few letters (10 minimum)"));
|
ed.lblPasswordMatch->setText(tr("Passphrase don't match or You have entered too few letters (16 minimum)"));
|
||||||
ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,7 +414,7 @@ void MainWindow::encryptWallet() {
|
|||||||
|
|
||||||
void MainWindow::removeWalletEncryption() {
|
void MainWindow::removeWalletEncryption() {
|
||||||
QDialog d(this);
|
QDialog d(this);
|
||||||
Ui_encryptionDialog ed;
|
Ui_removeencryption ed;
|
||||||
ed.setupUi(&d);
|
ed.setupUi(&d);
|
||||||
|
|
||||||
// Handle edits on the password box
|
// Handle edits on the password box
|
||||||
@@ -475,8 +476,6 @@ void MainWindow::removeWalletEncryption() {
|
|||||||
FileEncryption::decrypt(target_decwallet_file, target_encwallet_file, key);
|
FileEncryption::decrypt(target_decwallet_file, target_encwallet_file, key);
|
||||||
FileEncryption::decrypt(target_decaddr_file, target_encaddr_file, key);
|
FileEncryption::decrypt(target_decaddr_file, target_encaddr_file, key);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<author></author>
|
<ui version="4.0">
|
||||||
<comment></comment>
|
<class>removeencryption</class>
|
||||||
<exportmacro></exportmacro>
|
<widget class="QDialog" name="removeencryption">
|
||||||
<class>Dialog</class>
|
<property name="geometry">
|
||||||
<widget class="QDialog" name="Dialog" >
|
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
@@ -12,40 +10,168 @@
|
|||||||
<height>300</height>
|
<height>300</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Remove your Wallet encryption</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="geometry" >
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>30</x>
|
<x>50</x>
|
||||||
<y>240</y>
|
<y>260</y>
|
||||||
<width>341</width>
|
<width>341</width>
|
||||||
<height>32</height>
|
<height>32</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="standardButtons" >
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>260</x>
|
||||||
|
<y>170</y>
|
||||||
|
<width>133</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p>16 letters minimum</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>229</y>
|
||||||
|
<width>157</width>
|
||||||
|
<height>25</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Confirm Passphrase:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="Line" name="line_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>164</y>
|
||||||
|
<width>382</width>
|
||||||
|
<height>3</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="txtConfirmPassword">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>173</x>
|
||||||
|
<y>229</y>
|
||||||
|
<width>219</width>
|
||||||
|
<height>25</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Password</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>56</y>
|
||||||
|
<width>382</width>
|
||||||
|
<height>56</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p><span style=" font-size:14pt; color:#ef2929;">WARNING:</span> If yo remove your encryption, all your Data is Plaintext on your Disk!</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>260</y>
|
||||||
|
<width>382</width>
|
||||||
|
<height>3</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>198</y>
|
||||||
|
<width>157</width>
|
||||||
|
<height>25</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Encryption Passphrase:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="lblPasswordMatch">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>175</y>
|
||||||
|
<width>243</width>
|
||||||
|
<height>17</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: red;</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Passphrase don't match</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="txtPassword">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>173</x>
|
||||||
|
<y>198</y>
|
||||||
|
<width>219</width>
|
||||||
|
<height>25</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Password</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<pixmapfunction></pixmapfunction>
|
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>accepted()</signal>
|
<signal>accepted()</signal>
|
||||||
<receiver>Dialog</receiver>
|
<receiver>removeencryption</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel">
|
||||||
<x>248</x>
|
<x>248</x>
|
||||||
<y>254</y>
|
<y>254</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel">
|
||||||
<x>157</x>
|
<x>157</x>
|
||||||
<y>274</y>
|
<y>274</y>
|
||||||
</hint>
|
</hint>
|
||||||
@@ -54,14 +180,14 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>rejected()</signal>
|
<signal>rejected()</signal>
|
||||||
<receiver>Dialog</receiver>
|
<receiver>removeencryption</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel">
|
||||||
<x>316</x>
|
<x>316</x>
|
||||||
<y>260</y>
|
<y>260</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel">
|
||||||
<x>286</x>
|
<x>286</x>
|
||||||
<y>274</y>
|
<y>274</y>
|
||||||
</hint>
|
</hint>
|
||||||
@@ -69,4 +195,3 @@
|
|||||||
</connection>
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user