gui element to decrypt
This commit is contained in:
@@ -293,18 +293,51 @@ void MainWindow::encryptWallet() {
|
|||||||
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||||
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 target_dec_file = dir.filePath("addresslabels.dat.dec");
|
//QString target_dec_file = dir.filePath("addresslabels.dat.dec");
|
||||||
FileEncryption::encrypt(target_enc_file, source_file, key);
|
FileEncryption::encrypt(target_enc_file, source_file, key);
|
||||||
FileEncryption::decrypt(target_dec_file, target_enc_file, key);
|
// FileEncryption::decrypt(target_dec_file, target_enc_file, key);
|
||||||
|
|
||||||
d.exec();
|
d.exec();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::removeWalletEncryption() {
|
void MainWindow::removeWalletEncryption() {
|
||||||
// Check if wallet is already encrypted
|
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.
|
||||||
|
if (!ed.txtPassword->text().isEmpty() &&
|
||||||
|
ed.txtPassword->text() == ed.txtConfirmPassword->text()) {
|
||||||
|
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);
|
||||||
|
|
||||||
|
if (d.exec() == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
const unsigned char* key=PASSWD::hash(ed.txtPassword->text());
|
||||||
|
PASSWD::show_hex_buff((unsigned char*) key);
|
||||||
|
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||||
|
QString target_enc_file = dir.filePath("addresslabels.dat.enc");
|
||||||
|
QString target_dec_file = dir.filePath("addresslabels.dat");
|
||||||
|
FileEncryption::decrypt(target_dec_file, target_enc_file, key);
|
||||||
|
|
||||||
|
d.exec();
|
||||||
|
|
||||||
|
}
|
||||||
|
/*// Check if wallet is already encrypted
|
||||||
auto encStatus = rpc->getModel()->getEncryptionStatus();
|
auto encStatus = rpc->getModel()->getEncryptionStatus();
|
||||||
if (!encStatus.first) {
|
if (!encStatus.first) {
|
||||||
QMessageBox::information(this, tr("Wallet is not encrypted"),
|
QMessageBox::information(this, tr("Wallet is not encrypted"),
|
||||||
@@ -318,6 +351,8 @@ void MainWindow::removeWalletEncryption() {
|
|||||||
QString password = QInputDialog::getText(this, tr("Wallet Password"),
|
QString password = QInputDialog::getText(this, tr("Wallet Password"),
|
||||||
tr("Please enter your wallet password"), QLineEdit::Password, "", &ok);
|
tr("Please enter your wallet password"), QLineEdit::Password, "", &ok);
|
||||||
|
|
||||||
|
qDebug() << password;
|
||||||
|
|
||||||
// If cancel was pressed, just return
|
// If cancel was pressed, just return
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
return;
|
return;
|
||||||
@@ -356,7 +391,7 @@ void MainWindow::removeWalletEncryption() {
|
|||||||
QMessageBox::Ok
|
QMessageBox::Ok
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
}); */
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setupStatusBar() {
|
void MainWindow::setupStatusBar() {
|
||||||
|
|||||||
Reference in New Issue
Block a user