Merge pull request #46 from DenioD/encryption
Encryption to chatbranch - just for monitoring
This commit is contained in:
@@ -48,3 +48,9 @@ b FileSystem::writeContacts
|
||||
r
|
||||
n
|
||||
q
|
||||
r
|
||||
b FileEncryption::encrypt
|
||||
r
|
||||
s
|
||||
n
|
||||
q
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
break FileSystem::writeContacts
|
||||
break FileEncryption::encrypt
|
||||
|
||||
|
||||
@@ -83,7 +83,8 @@ SOURCES += \
|
||||
src/Chat/Helper/ChatIDGenerator.cpp \
|
||||
src/Chat/Chat.cpp \
|
||||
src/FileSystem/FileSystem.cpp \
|
||||
src/Crypto/FileEncryption.cpp
|
||||
src/Crypto/FileEncryption.cpp \
|
||||
src/Crypto/passwd.cpp
|
||||
|
||||
HEADERS += \
|
||||
src/firsttimewizard.h \
|
||||
@@ -132,6 +133,7 @@ FORMS += \
|
||||
src/confirm.ui \
|
||||
src/privkey.ui \
|
||||
src/memodialog.ui \
|
||||
src/startupencryption.ui \
|
||||
src/viewalladdresses.ui \
|
||||
src/connection.ui \
|
||||
src/addressbook.ui \
|
||||
@@ -141,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
|
||||
|
||||
@@ -7,42 +7,48 @@ void FileEncryption::showConfig()
|
||||
|
||||
int FileEncryption::encrypt(QString target_file, QString source_file, const unsigned char key[crypto_secretstream_xchacha20poly1305_KEYBYTES])
|
||||
{
|
||||
unsigned char buf_in[FILEENCRYPTION_CHUNK_SIZE];
|
||||
unsigned char buf_out[FILEENCRYPTION_CHUNK_SIZE + crypto_secretstream_xchacha20poly1305_ABYTES];
|
||||
unsigned char plain_data[FILEENCRYPTION_CHUNK_SIZE];
|
||||
unsigned char cipher_data[FILEENCRYPTION_CHUNK_SIZE + crypto_secretstream_xchacha20poly1305_ABYTES];
|
||||
unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES];
|
||||
crypto_secretstream_xchacha20poly1305_state st;
|
||||
FILE *fp_t, *fp_s;
|
||||
unsigned long long out_len;
|
||||
crypto_secretstream_xchacha20poly1305_state state;
|
||||
FILE *target, *source;
|
||||
unsigned long long cipher_len;
|
||||
size_t rlen;
|
||||
int eof;
|
||||
unsigned char tag;
|
||||
|
||||
fp_s = fopen(source_file.toStdString().c_str(), "rb");
|
||||
fp_t = fopen(target_file.toStdString().c_str(), "wb");
|
||||
crypto_secretstream_xchacha20poly1305_init_push(&st, header, key);
|
||||
fwrite(header, 1, sizeof header, fp_t);
|
||||
if(!FileEncryption::exists(source_file.toStdString()))
|
||||
{
|
||||
qDebug() << "File not exits" << source_file;
|
||||
return -1;
|
||||
}
|
||||
|
||||
source = fopen(source_file.toStdString().c_str(), "rb");
|
||||
target = fopen(target_file.toStdString().c_str(), "wb");
|
||||
crypto_secretstream_xchacha20poly1305_init_push(&state, header, key);
|
||||
fwrite(header, 1, sizeof header, target);
|
||||
do
|
||||
{
|
||||
rlen = fread(buf_in, 1, sizeof buf_in, fp_s);
|
||||
eof = feof(fp_s);
|
||||
rlen = fread(plain_data, 1, sizeof plain_data, source);
|
||||
eof = feof(source);
|
||||
tag = eof ? crypto_secretstream_xchacha20poly1305_TAG_FINAL : 0;
|
||||
crypto_secretstream_xchacha20poly1305_push(
|
||||
&st,
|
||||
buf_out,
|
||||
&out_len,
|
||||
buf_in,
|
||||
&state,
|
||||
cipher_data,
|
||||
&cipher_len,
|
||||
plain_data,
|
||||
rlen,
|
||||
NULL,
|
||||
0,
|
||||
tag
|
||||
);
|
||||
|
||||
fwrite(buf_out, 1, (size_t) out_len, fp_t);
|
||||
fwrite(cipher_data, 1, (size_t) cipher_len, target);
|
||||
}
|
||||
while (! eof);
|
||||
|
||||
fclose(fp_t);
|
||||
fclose(fp_s);
|
||||
fclose(target);
|
||||
fclose(source);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -59,6 +65,12 @@ int FileEncryption::decrypt(QString target_file, QString source_file, const unsi
|
||||
int ret = -1;
|
||||
unsigned char tag;
|
||||
|
||||
if(!FileEncryption::exists(source_file.toStdString()))
|
||||
{
|
||||
qDebug() << "File not exits" << source_file;
|
||||
return -1;
|
||||
}
|
||||
|
||||
fp_s = fopen(source_file.toStdString().c_str(), "rb");
|
||||
fp_t = fopen(target_file.toStdString().c_str(), "wb");
|
||||
fread(header, 1, sizeof header, fp_s);
|
||||
|
||||
@@ -3,11 +3,17 @@
|
||||
#include <stdio.h>
|
||||
#include <sodium.h>
|
||||
#include <QString>
|
||||
#include <fstream>
|
||||
|
||||
#define FILEENCRYPTION_CHUNK_SIZE 4096
|
||||
|
||||
class FileEncryption
|
||||
{
|
||||
private:
|
||||
inline static bool exists (const std::string& name) {
|
||||
std::ifstream f(name.c_str());
|
||||
return f.good();
|
||||
}
|
||||
public:
|
||||
static void showConfig();
|
||||
static int encrypt(QString target_file, QString source_file, const unsigned char key[crypto_secretstream_xchacha20poly1305_KEYBYTES]);
|
||||
|
||||
60
src/Crypto/passwd.cpp
Normal file
60
src/Crypto/passwd.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
#include "passwd.h"
|
||||
|
||||
void PASSWD::show_hex_buff(unsigned char buf[])
|
||||
{
|
||||
int i;
|
||||
for (uint8_t i=0; i < crypto_secretstream_xchacha20poly1305_KEYBYTES; i++)
|
||||
printf("%02X ", buf[i]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
const unsigned char* PASSWD::key(QString password)
|
||||
{
|
||||
|
||||
int length = password.length();
|
||||
|
||||
char *sequence = NULL;
|
||||
sequence = new char[length+1];
|
||||
strncpy(sequence, password.toLocal8Bit(), length +1);
|
||||
|
||||
#define MESSAGE ((const unsigned char *) sequence)
|
||||
#define MESSAGE_LEN length
|
||||
|
||||
unsigned char hash[crypto_secretstream_xchacha20poly1305_KEYBYTES];
|
||||
|
||||
crypto_hash_sha256(hash, MESSAGE, MESSAGE_LEN);
|
||||
|
||||
qDebug()<<"Generating SaltHash from password: " <<sequence;
|
||||
|
||||
|
||||
/////////we use the Hash of the Password as Salt, not perfect but still a good solution.
|
||||
|
||||
#define PASSWORD sequence
|
||||
#define KEY_LEN crypto_box_SEEDBYTES
|
||||
|
||||
unsigned char key[KEY_LEN];
|
||||
|
||||
if (crypto_pwhash
|
||||
(key, sizeof key, PASSWORD, strlen(PASSWORD), hash,
|
||||
crypto_pwhash_OPSLIMIT_SENSITIVE, crypto_pwhash_MEMLIMIT_SENSITIVE,
|
||||
crypto_pwhash_ALG_DEFAULT) != 0) {
|
||||
/* out of memory */
|
||||
}
|
||||
|
||||
qDebug()<<"Generating cryptographic key from password: " <<sequence;
|
||||
|
||||
|
||||
// crypto_generichash(blacke2hash, sizeof hash, MESSAGE, MESSAGE_LEN, NULL, 0);
|
||||
|
||||
//for(uint8_t i = 0; i < crypto_secretstream_xchacha20poly1305_KEYBYTES/2; i++)
|
||||
// hash[i] = blacke2hash[i];
|
||||
|
||||
// for(uint8_t i = crypto_secretstream_xchacha20poly1305_KEYBYTES/2; i < crypto_secretstream_xchacha20poly1305_KEYBYTES; i++)
|
||||
// hash[i] = sha256hash[i];
|
||||
|
||||
// delete[] sha256hash;
|
||||
//delete[] blacke2hash;
|
||||
qDebug()<<"secret key generated:\n";
|
||||
PASSWD::show_hex_buff(key);
|
||||
return key;
|
||||
}
|
||||
14
src/Crypto/passwd.h
Normal file
14
src/Crypto/passwd.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef PASSWD_H
|
||||
#define PASSWD_H
|
||||
#include <stdio.h>
|
||||
#include <sodium.h>
|
||||
#include <QString>
|
||||
|
||||
class PASSWD
|
||||
{
|
||||
public:
|
||||
static void show_hex_buff(unsigned char buf[]);
|
||||
static const unsigned char* key(QString);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include "../Crypto/passwd.h"
|
||||
|
||||
FileSystem::FileSystem()
|
||||
{
|
||||
|
||||
@@ -14,65 +14,23 @@
|
||||
<string>Encrypt Your Wallet</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="Line" name="line_2">
|
||||
<item row="0" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Encryption Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Confirm Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="txtConfirmPassword">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QLabel" name="lblPasswordMatch">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: red;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Passwords don't match</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="txtPassword">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>WARNING: If you forget your password, the only way to recover the wallet is from the seed phrase.</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>
|
||||
@@ -82,6 +40,81 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0" rowspan="2" colspan="3">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2" rowspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>16 letters minimum</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QLabel" name="lblPasswordMatch">
|
||||
<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>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Encryption Passphrase:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="txtPassword">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Confirm Passphrase:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="txtConfirmPassword">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="3">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
@@ -95,32 +128,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
|
||||
@@ -21,15 +21,36 @@
|
||||
#include "ui_requestContactDialog.h"
|
||||
#include "chatmodel.h"
|
||||
#include "requestdialog.h"
|
||||
#include "ui_startupencryption.h"
|
||||
#include "ui_removeencryption.h"
|
||||
#include "websockets.h"
|
||||
#include "sodium.h"
|
||||
#include "sodium/crypto_generichash_blake2b.h"
|
||||
#include <QRegularExpression>
|
||||
#include "FileSystem/FileSystem.h"
|
||||
#include "Crypto/passwd.h"
|
||||
#include "Crypto/FileEncryption.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
auto dirwallet = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet.dat");
|
||||
auto dirwalletenc = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet-enc.dat");
|
||||
auto dirwalletbackup = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet.datBackup");
|
||||
#endif
|
||||
#ifdef Q_OS_UNIX
|
||||
auto dirwallet = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath(".silentdragonlite/silentdragonlite-wallet.dat");
|
||||
auto dirwalletenc = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath(".silentdragonlite/silentdragonlite-wallet-enc.dat");
|
||||
auto dirwalletbackup = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath(".silentdragonlite/silentdragonlite-wallet.datBackup");
|
||||
#endif
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
|
||||
// Include css
|
||||
QString theme_name;
|
||||
try
|
||||
@@ -47,12 +68,19 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
|
||||
logger = new Logger(this, QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite-wallet.log"));
|
||||
// Check for encryption
|
||||
|
||||
|
||||
|
||||
if(fileExists(dirwalletenc))
|
||||
{
|
||||
this->removeWalletEncryptionStartUp();
|
||||
}
|
||||
|
||||
ui->memoTxtChat->setAutoFillBackground(false);
|
||||
ui->memoTxtChat->setPlaceholderText("Send Message");
|
||||
ui->memoTxtChat->setTextColor(Qt::white);
|
||||
|
||||
|
||||
|
||||
|
||||
// Status Bar
|
||||
setupStatusBar();
|
||||
|
||||
@@ -180,6 +208,12 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
createWebsocket(wormholecode);
|
||||
}
|
||||
}
|
||||
|
||||
bool MainWindow::fileExists(QString path)
|
||||
{
|
||||
QFileInfo check_file(path);
|
||||
return (check_file.exists() && check_file.isFile());
|
||||
}
|
||||
|
||||
void MainWindow::createWebsocket(QString wormholecode) {
|
||||
qDebug() << "Listening for app connections on port 8777";
|
||||
@@ -234,6 +268,10 @@ void MainWindow::doClose() {
|
||||
closeEvent(nullptr);
|
||||
}
|
||||
|
||||
void MainWindow::doClosePw() {
|
||||
closeEventpw(nullptr);
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent* event) {
|
||||
QSettings s;
|
||||
|
||||
@@ -243,6 +281,78 @@ void MainWindow::closeEvent(QCloseEvent* event) {
|
||||
|
||||
s.sync();
|
||||
|
||||
|
||||
// Let the RPC know to shut down any running service.
|
||||
rpc->shutdownhushd();
|
||||
|
||||
// Check is encryption is ON for SDl
|
||||
if(fileExists(dirwalletenc))
|
||||
|
||||
{
|
||||
// delete old file before
|
||||
|
||||
//auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
|
||||
QFile fileoldencryption(dirwalletenc);
|
||||
fileoldencryption.remove();
|
||||
|
||||
// Encrypt our wallet.dat
|
||||
QString str = this->getPassword();
|
||||
// QString str = ed.txtPassword->text(); // data comes from user inputs
|
||||
int length = str.length();
|
||||
|
||||
char *sequence = NULL;
|
||||
sequence = new char[length+1];
|
||||
strncpy(sequence, str.toLocal8Bit(), length +1);
|
||||
|
||||
#define MESSAGE ((const unsigned char *) sequence)
|
||||
#define MESSAGE_LEN length
|
||||
|
||||
unsigned char hash[crypto_secretstream_xchacha20poly1305_KEYBYTES];
|
||||
|
||||
crypto_hash_sha256(hash,MESSAGE, MESSAGE_LEN);
|
||||
|
||||
#define PASSWORD sequence
|
||||
#define KEY_LEN crypto_box_SEEDBYTES
|
||||
|
||||
|
||||
|
||||
/////////we use the Hash of the Password as Salt, not perfect but still a good solution.
|
||||
|
||||
unsigned char key[KEY_LEN];
|
||||
|
||||
if (crypto_pwhash
|
||||
(key, sizeof key, PASSWORD, strlen(PASSWORD), hash,
|
||||
crypto_pwhash_OPSLIMIT_SENSITIVE, crypto_pwhash_MEMLIMIT_SENSITIVE,
|
||||
crypto_pwhash_ALG_DEFAULT) != 0) {
|
||||
/* out of memory */
|
||||
}
|
||||
|
||||
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||
// 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 = dirwallet;
|
||||
QString target_encWallet_file = dirwalletenc;
|
||||
|
||||
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.
|
||||
|
||||
QFile wallet(dirwallet);
|
||||
QFile address(dir.filePath("addresslabels.dat"));
|
||||
wallet.remove();
|
||||
address.remove();
|
||||
}
|
||||
|
||||
|
||||
// Bubble up
|
||||
if (event)
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
void MainWindow::closeEventpw(QCloseEvent* event) {
|
||||
|
||||
// Let the RPC know to shut down any running service.
|
||||
rpc->shutdownhushd();
|
||||
|
||||
@@ -253,124 +363,299 @@ void MainWindow::closeEvent(QCloseEvent* event) {
|
||||
|
||||
|
||||
void MainWindow::encryptWallet() {
|
||||
// Check if wallet is already encrypted
|
||||
auto encStatus = rpc->getModel()->getEncryptionStatus();
|
||||
if (encStatus.first) {
|
||||
QMessageBox::information(this, tr("Wallet is already encrypted"),
|
||||
tr("Your wallet is already encrypted with a password.\nPlease use 'Remove Wallet Encryption' if you want to remove the wallet encryption."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
QDialog d(this);
|
||||
Ui_encryptionDialog ed;
|
||||
ed.setupUi(&d);
|
||||
|
||||
// Handle edits on the password box
|
||||
|
||||
|
||||
auto fnPasswordEdited = [=](const QString&) {
|
||||
// Enable the OK button if the passwords match.
|
||||
QString password = ed.txtPassword->text();
|
||||
|
||||
if (!ed.txtPassword->text().isEmpty() &&
|
||||
ed.txtPassword->text() == ed.txtConfirmPassword->text()) {
|
||||
ed.txtPassword->text() == ed.txtConfirmPassword->text() && password.size() >= 16) {
|
||||
ed.lblPasswordMatch->setText("");
|
||||
ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||
} else {
|
||||
ed.lblPasswordMatch->setText(tr("Passphrase don't match or You have entered too few letters (16 minimum)"));
|
||||
ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
QObject::connect(ed.txtConfirmPassword, &QLineEdit::textChanged, fnPasswordEdited);
|
||||
QObject::connect(ed.txtPassword, &QLineEdit::textChanged, fnPasswordEdited);
|
||||
|
||||
if (d.exec() == QDialog::Accepted)
|
||||
{
|
||||
|
||||
QString str = ed.txtPassword->text(); // data comes from user inputs
|
||||
int length = str.length();
|
||||
this->setPassword(str);
|
||||
|
||||
char *sequence = NULL;
|
||||
sequence = new char[length+1];
|
||||
strncpy(sequence, str.toLocal8Bit(), length +1);
|
||||
|
||||
#define MESSAGE ((const unsigned char *) sequence)
|
||||
#define MESSAGE_LEN length
|
||||
|
||||
unsigned char hash[crypto_secretstream_xchacha20poly1305_KEYBYTES];
|
||||
|
||||
crypto_hash_sha256(hash,MESSAGE, MESSAGE_LEN);
|
||||
|
||||
#define PASSWORD sequence
|
||||
#define KEY_LEN crypto_box_SEEDBYTES
|
||||
|
||||
|
||||
|
||||
/////////we use the Hash of the Password as Salt, not perfect but still a good solution.
|
||||
|
||||
unsigned char key[KEY_LEN];
|
||||
|
||||
if (crypto_pwhash
|
||||
(key, sizeof key, PASSWORD, strlen(PASSWORD), hash,
|
||||
crypto_pwhash_OPSLIMIT_SENSITIVE, crypto_pwhash_MEMLIMIT_SENSITIVE,
|
||||
crypto_pwhash_ALG_DEFAULT) != 0) {
|
||||
/* out of memory */
|
||||
}
|
||||
|
||||
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||
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 = dirwallet;
|
||||
QString target_encWallet_file = dirwalletenc;
|
||||
|
||||
FileEncryption::encrypt(target_enc_file, source_file, key);
|
||||
FileEncryption::encrypt(target_encWallet_file, sourceWallet_file, key);
|
||||
|
||||
QFile wallet(dirwallet);
|
||||
QFile address(dir.filePath("addresslabels.dat"));
|
||||
wallet.rename(dirwalletbackup);
|
||||
address.rename(dir.filePath("addresslabels.datBackup"));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::removeWalletEncryption() {
|
||||
QDialog d(this);
|
||||
Ui_removeencryption ed;
|
||||
ed.setupUi(&d);
|
||||
|
||||
auto fnPasswordEdited = [=](const QString&) {
|
||||
QString password = ed.txtPassword->text();
|
||||
// Enable the OK button if the passwords match.
|
||||
if (!ed.txtPassword->text().isEmpty() &&
|
||||
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"));
|
||||
ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
QObject::connect(ed.txtConfirmPassword, &QLineEdit::textChanged, fnPasswordEdited);
|
||||
QObject::connect(ed.txtPassword, &QLineEdit::textChanged, fnPasswordEdited);
|
||||
|
||||
ed.txtPassword->setText("");
|
||||
ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
if (d.exec() == QDialog::Accepted)
|
||||
{
|
||||
QString str = ed.txtPassword->text(); // data comes from user inputs
|
||||
int length = str.length();
|
||||
|
||||
auto fnShowError = [=](QString title, const json& res) {
|
||||
QMessageBox::critical(this, title,
|
||||
tr("Error was:\n") + QString::fromStdString(res.dump()),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
};
|
||||
char *sequence = NULL;
|
||||
sequence = new char[length+1];
|
||||
strncpy(sequence, str.toLocal8Bit(), length +1);
|
||||
|
||||
if (d.exec() == QDialog::Accepted) {
|
||||
rpc->encryptWallet(ed.txtPassword->text(), [=](json res) {
|
||||
if (isJsonResultSuccess(res)) {
|
||||
// Save the wallet
|
||||
rpc->saveWallet([=] (json reply) {
|
||||
if (isJsonResultSuccess(reply)) {
|
||||
QMessageBox::information(this, tr("Wallet Encrypted"),
|
||||
tr("Your wallet was successfully encrypted! The password will be needed to send funds or export private keys."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
} else {
|
||||
fnShowError(tr("Wallet Encryption Failed"), reply);
|
||||
}
|
||||
});
|
||||
#define MESSAGE ((const unsigned char *) sequence)
|
||||
#define MESSAGE_LEN length
|
||||
|
||||
unsigned char hash[crypto_secretstream_xchacha20poly1305_KEYBYTES];
|
||||
|
||||
crypto_hash_sha256(hash,MESSAGE, MESSAGE_LEN);
|
||||
|
||||
#define PASSWORD sequence
|
||||
#define KEY_LEN crypto_box_SEEDBYTES
|
||||
|
||||
|
||||
|
||||
/////////we use the Hash of the Password as Salt, not perfect but still a good solution.
|
||||
|
||||
unsigned char key[KEY_LEN];
|
||||
|
||||
if (crypto_pwhash
|
||||
(key, sizeof key, PASSWORD, strlen(PASSWORD), hash,
|
||||
crypto_pwhash_OPSLIMIT_SENSITIVE, crypto_pwhash_MEMLIMIT_SENSITIVE,
|
||||
crypto_pwhash_ALG_DEFAULT) != 0) {
|
||||
/* out of memory */
|
||||
}
|
||||
|
||||
|
||||
|
||||
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||
auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
|
||||
QString target_encwallet_file = dirwalletenc;
|
||||
QString target_decwallet_file = dirwallet;
|
||||
QString target_encaddr_file = dir.filePath("addresslabels.dat.enc");
|
||||
QString target_decaddr_file = dir.filePath("addresslabels.dat");
|
||||
|
||||
FileEncryption::decrypt(target_decwallet_file, target_encwallet_file, key);
|
||||
FileEncryption::decrypt(target_decaddr_file, target_encaddr_file, key);
|
||||
|
||||
QFile filencrypted(dirwalletenc);
|
||||
QFile wallet(dirwallet);
|
||||
|
||||
if (wallet.size() > 0)
|
||||
{
|
||||
|
||||
QMessageBox::information(this, tr("Wallet decryption Success"),
|
||||
QString("Successfully delete the encryption"),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
|
||||
filencrypted.remove();
|
||||
|
||||
}else{
|
||||
|
||||
qDebug()<<"verschlüsselung gescheitert ";
|
||||
|
||||
QMessageBox::critical(this, tr("Wallet Encryption Failed"),
|
||||
QString("False password, please try again"),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
this->removeWalletEncryption();
|
||||
}
|
||||
|
||||
// And then refresh the UI
|
||||
rpc->refresh(true);
|
||||
} else {
|
||||
fnShowError(tr("Wallet Encryption Failed"), res);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::removeWalletEncryption() {
|
||||
// Check if wallet is already encrypted
|
||||
auto encStatus = rpc->getModel()->getEncryptionStatus();
|
||||
if (!encStatus.first) {
|
||||
QMessageBox::information(this, tr("Wallet is not encrypted"),
|
||||
tr("Your wallet is not encrypted with a password."),
|
||||
void MainWindow::removeWalletEncryptionStartUp() {
|
||||
QDialog d(this);
|
||||
Ui_startup ed;
|
||||
ed.setupUi(&d);
|
||||
|
||||
// Handle edits on the password box
|
||||
|
||||
auto fnPasswordEdited = [=](const QString&) {
|
||||
QString password = ed.txtPassword->text();
|
||||
// Enable the OK button if the passwords match.
|
||||
if (!ed.txtPassword->text().isEmpty() &&
|
||||
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 under-lettered"));
|
||||
ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
QObject::connect(ed.txtConfirmPassword, &QLineEdit::textChanged, fnPasswordEdited);
|
||||
QObject::connect(ed.txtPassword, &QLineEdit::textChanged, fnPasswordEdited);
|
||||
|
||||
if (d.exec() == QDialog::Accepted)
|
||||
{
|
||||
QString str = ed.txtPassword->text(); // data comes from user inputs
|
||||
int length = str.length();
|
||||
this->setPassword(str);
|
||||
char *sequence = NULL;
|
||||
sequence = new char[length+1];
|
||||
strncpy(sequence, str.toLocal8Bit(), length +1);
|
||||
|
||||
#define MESSAGE ((const unsigned char *) sequence)
|
||||
#define MESSAGE_LEN length
|
||||
|
||||
unsigned char hash[crypto_secretstream_xchacha20poly1305_KEYBYTES];
|
||||
|
||||
crypto_hash_sha256(hash,MESSAGE, MESSAGE_LEN);
|
||||
|
||||
#define PASSWORD sequence
|
||||
#define KEY_LEN crypto_box_SEEDBYTES
|
||||
|
||||
|
||||
|
||||
/////////we use the Hash of the Password as Salt, not perfect but still a good solution.
|
||||
|
||||
unsigned char key[KEY_LEN];
|
||||
|
||||
if (crypto_pwhash
|
||||
(key, sizeof key, PASSWORD, strlen(PASSWORD), hash,
|
||||
crypto_pwhash_OPSLIMIT_SENSITIVE, crypto_pwhash_MEMLIMIT_SENSITIVE,
|
||||
crypto_pwhash_ALG_DEFAULT) != 0) {
|
||||
/* out of memory */
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||
auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
|
||||
QString target_encwallet_file = dirwalletenc;
|
||||
QString target_decwallet_file = dirwallet;
|
||||
QString target_encaddr_file = dir.filePath("addresslabels.dat.enc");
|
||||
QString target_decaddr_file = dir.filePath("addresslabels.dat");
|
||||
|
||||
FileEncryption::decrypt(target_decwallet_file, target_encwallet_file, key);
|
||||
FileEncryption::decrypt(target_decaddr_file, target_encaddr_file, key);
|
||||
|
||||
}
|
||||
|
||||
auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
|
||||
QFile wallet(dirwallet);
|
||||
//QFile backup(dirHome.filePath(".silentdragonlite/silentdragonlite-wallet.datBACKUP"));*/
|
||||
|
||||
if (wallet.size() > 0)
|
||||
{
|
||||
if (fileExists(dirwalletbackup))
|
||||
|
||||
{
|
||||
|
||||
QMessageBox::warning(this, tr("You have still Plaintextdata on your disk!"),
|
||||
QString("WARNING: Delete it only if you have a backup of your Wallet Seed."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
// backup.remove();
|
||||
|
||||
}
|
||||
|
||||
QMessageBox::information(this, tr("Wallet Encryption Success"),
|
||||
QString("SDL is ready to Rock"),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
qDebug()<<"verschlüsselung gescheitert ";
|
||||
|
||||
QMessageBox::critical(this, tr("Wallet Encryption Failed"),
|
||||
QString("false password please try again"),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
return;
|
||||
this->removeWalletEncryptionStartUp();
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
this->doClosePw();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool ok;
|
||||
QString password = QInputDialog::getText(this, tr("Wallet Password"),
|
||||
tr("Please enter your wallet password"), QLineEdit::Password, "", &ok);
|
||||
QString MainWindow::getPassword()
|
||||
{
|
||||
|
||||
// If cancel was pressed, just return
|
||||
if (!ok) {
|
||||
return;
|
||||
}
|
||||
return _password;
|
||||
}
|
||||
|
||||
if (password.isEmpty()) {
|
||||
QMessageBox::critical(this, tr("Wallet Decryption Failed"),
|
||||
tr("Please enter a password to decrypt your wallet!"),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
return;
|
||||
}
|
||||
void MainWindow::setPassword(QString password)
|
||||
{
|
||||
|
||||
rpc->removeWalletEncryption(password, [=] (json res) {
|
||||
if (isJsonResultSuccess(res)) {
|
||||
// Save the wallet
|
||||
rpc->saveWallet([=] (json reply) {
|
||||
if(isJsonResultSuccess(reply)) {
|
||||
QMessageBox::information(this, tr("Wallet Encryption Removed"),
|
||||
tr("Your wallet was successfully decrypted! You will no longer need a password to send funds or export private keys."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
} else {
|
||||
QMessageBox::critical(this, tr("Wallet Decryption Failed"),
|
||||
QString::fromStdString(reply["error"].get<json::string_t>()),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// And then refresh the UI
|
||||
rpc->refresh(true);
|
||||
} else {
|
||||
QMessageBox::critical(this, tr("Wallet Decryption Failed"),
|
||||
QString::fromStdString(res["error"].get<json::string_t>()),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
}
|
||||
});
|
||||
_password = password;
|
||||
}
|
||||
|
||||
void MainWindow::setupStatusBar() {
|
||||
|
||||
@@ -51,6 +51,8 @@ public:
|
||||
QString doSendChatTxValidations(Tx tx);
|
||||
QString doSendRequestTxValidations(Tx tx);
|
||||
QString getCid();
|
||||
QString getPassword();
|
||||
void setPassword(QString Password);
|
||||
|
||||
void replaceWormholeClient(WormholeClient* newClient);
|
||||
bool isWebsocketListening();
|
||||
@@ -86,6 +88,7 @@ public:
|
||||
Logger* logger;
|
||||
|
||||
void doClose();
|
||||
void doClosePw();
|
||||
QString createHeaderMemo(QString type, QString cid, QString zaddr, int version, int headerNumber);
|
||||
|
||||
public slots:
|
||||
@@ -100,7 +103,9 @@ private slots:
|
||||
|
||||
private:
|
||||
|
||||
bool fileExists(QString path);
|
||||
void closeEvent(QCloseEvent* event);
|
||||
void closeEventpw(QCloseEvent* event);
|
||||
|
||||
|
||||
void setupSendTab();
|
||||
@@ -119,6 +124,7 @@ private:
|
||||
void setupStatusBar();
|
||||
|
||||
void clearSendForm();
|
||||
QString _password;
|
||||
|
||||
Tx createTxFromSendPage();
|
||||
bool confirmTx(Tx tx, RecurringPaymentInfo* rpi);
|
||||
@@ -129,6 +135,7 @@ private:
|
||||
|
||||
void encryptWallet();
|
||||
void removeWalletEncryption();
|
||||
void removeWalletEncryptionStartUp();
|
||||
|
||||
void cancelButton();
|
||||
void sendButton();
|
||||
|
||||
197
src/removeencryption.ui
Normal file
197
src/removeencryption.ui
Normal file
@@ -0,0 +1,197 @@
|
||||
<?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>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Remove your Wallet encryption</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>260</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<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>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>removeencryption</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>removeencryption</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
184
src/startupencryption.ui
Normal file
184
src/startupencryption.ui
Normal file
@@ -0,0 +1,184 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>startup</class>
|
||||
<widget class="QDialog" name="startup">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>SDL Startup Decryption</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>260</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>229</y>
|
||||
<width>127</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Confirm Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>166</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>162</x>
|
||||
<y>229</y>
|
||||
<width>230</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>58</y>
|
||||
<width>382</width>
|
||||
<height>56</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>If you have forgotten your password, restore your wallet with your seed!</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>146</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Encryption Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lblPasswordMatch">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>175</y>
|
||||
<width>382</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: red;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Passwords don't match</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="txtPassword">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>162</x>
|
||||
<y>198</y>
|
||||
<width>230</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>startup</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>startup</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user