new gui elements for encryption
This commit is contained in:
@@ -143,6 +143,7 @@ FORMS += \
|
||||
src/requestContactDialog.ui \
|
||||
src/newrecurring.ui \
|
||||
src/requestdialog.ui \
|
||||
src/removeencryption.ui \
|
||||
src/recurringmultiple.ui \
|
||||
src/chatbubbleme.ui \
|
||||
src/chatbubblepartner.ui
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<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 name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
@@ -63,7 +63,7 @@
|
||||
<item row="4" column="2" rowspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<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>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -73,7 +73,7 @@
|
||||
<string notr="true">color: red;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Passwords don't match</string>
|
||||
<string>Passphrase don't match</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
@@ -83,7 +83,7 @@
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Encryption Password:</string>
|
||||
<string>Encryption Passphrase:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -97,7 +97,7 @@
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Confirm Password:</string>
|
||||
<string>Confirm Passphrase:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
#include "ui_requestContactDialog.h"
|
||||
#include "chatmodel.h"
|
||||
#include "requestdialog.h"
|
||||
#include "ui_startupencryption.h"
|
||||
#include "ui_startupencryption.h"
|
||||
#include "ui_removeencryption.h"
|
||||
#include "websockets.h"
|
||||
#include "sodium.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")))
|
||||
|
||||
{
|
||||
|
||||
|
||||
// delete old file before
|
||||
|
||||
auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
|
||||
QFile file1(dirHome.filePath(".silentdragonlite/silentdragonlite-wallet-enc.dat"));
|
||||
file1.remove();
|
||||
QFile fileoldencryption(dirHome.filePath(".silentdragonlite/silentdragonlite-wallet-enc.dat"));
|
||||
fileoldencryption.remove();
|
||||
|
||||
// Encrypt our wallet.dat
|
||||
QString str = "123";///just for testing. We set the user pw here
|
||||
// QString str = ed.txtPassword->text(); // data comes from user inputs
|
||||
int length = str.length();
|
||||
// Encrypt our wallet.dat
|
||||
QString str = "123";///just for testing. We set the user pw here
|
||||
// QString str = ed.txtPassword->text(); // data comes from user inputs
|
||||
int length = str.length();
|
||||
|
||||
char *sequence = NULL;
|
||||
sequence = new char[length+1];
|
||||
@@ -309,7 +308,7 @@ void MainWindow::closeEvent(QCloseEvent* event) {
|
||||
}
|
||||
|
||||
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 target_enc_file = dir.filePath("addresslabels.dat.enc");
|
||||
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_encWallet_file, sourceWallet_file, key);
|
||||
|
||||
}
|
||||
///////////////// we rename the plaintext wallet.dat to Backup, for testing.
|
||||
auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
|
||||
QFile file1(dirHome.filePath(".silentdragonlite/silentdragonlite-wallet.datBACKUP"));
|
||||
file1.remove();
|
||||
///////////////// we rename the plaintext wallet.dat to Backup, for testing.
|
||||
|
||||
QFile fileoldbackup(dirHome.filePath(".silentdragonlite/silentdragonlite-wallet.datBACKUP"));
|
||||
fileoldbackup.remove();
|
||||
QFile file(dirHome.filePath(".silentdragonlite/silentdragonlite-wallet.dat"));
|
||||
file.rename(dirHome.filePath(".silentdragonlite/silentdragonlite-wallet.datBACKUP"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Bubble up
|
||||
if (event)
|
||||
QMainWindow::closeEvent(event);
|
||||
@@ -351,11 +352,11 @@ void MainWindow::encryptWallet() {
|
||||
// Enable the OK button if the passwords match.
|
||||
QString password = ed.txtPassword->text();
|
||||
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.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||
} 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);
|
||||
}
|
||||
|
||||
@@ -413,7 +414,7 @@ void MainWindow::encryptWallet() {
|
||||
|
||||
void MainWindow::removeWalletEncryption() {
|
||||
QDialog d(this);
|
||||
Ui_encryptionDialog ed;
|
||||
Ui_removeencryption ed;
|
||||
ed.setupUi(&d);
|
||||
|
||||
// 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_decaddr_file, target_encaddr_file, key);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<ui version="4.0" >
|
||||
<author></author>
|
||||
<comment></comment>
|
||||
<exportmacro></exportmacro>
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog" >
|
||||
<property name="geometry" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>removeencryption</class>
|
||||
<widget class="QDialog" name="removeencryption">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
@@ -12,40 +10,168 @@
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Dialog</string>
|
||||
<property name="windowTitle">
|
||||
<string>Remove your Wallet encryption</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="geometry" >
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>240</y>
|
||||
<x>50</x>
|
||||
<y>260</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</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>
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<receiver>removeencryption</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
@@ -54,14 +180,14 @@
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<receiver>removeencryption</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
@@ -69,4 +195,3 @@
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user