Permalink
Browse files

askpassphrasedialog: clear pass fields on accept

  • Loading branch information...
Tranz5 committed Aug 16, 2014
1 parent 846c5a6 commit a6ac37e0c127eb6114e47e9c27be8ab0955f6157
Showing with 16 additions and 4 deletions.
  1. +15 −4 src/qt/askpassphrasedialog.cpp
  2. +1 −0 src/qt/askpassphrasedialog.h
@@ -71,10 +71,7 @@ AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget *parent) :
AskPassphraseDialog::~AskPassphraseDialog()
{
// Attempt to overwrite text so that they do not linger around in memory
ui->passEdit1->setText(QString(" ").repeated(ui->passEdit1->text().size()));
ui->passEdit2->setText(QString(" ").repeated(ui->passEdit2->text().size()));
ui->passEdit3->setText(QString(" ").repeated(ui->passEdit3->text().size()));
secureClearPassFields();
delete ui;
}
@@ -97,6 +94,8 @@ void AskPassphraseDialog::accept()
newpass1.assign(ui->passEdit2->text().toStdString().c_str());
newpass2.assign(ui->passEdit3->text().toStdString().c_str());
secureClearPassFields();
switch(mode)
{
case Encrypt: {
@@ -266,3 +265,15 @@ bool AskPassphraseDialog::eventFilter(QObject *object, QEvent *event)
}
return QDialog::eventFilter(object, event);
}
void AskPassphraseDialog::secureClearPassFields()
{
// Attempt to overwrite text so that they do not linger around in memory
ui->passEdit1->setText(QString(" ").repeated(ui->passEdit1->text().size()));
ui->passEdit2->setText(QString(" ").repeated(ui->passEdit2->text().size()));
ui->passEdit3->setText(QString(" ").repeated(ui->passEdit3->text().size()));
ui->passEdit1->clear();
ui->passEdit2->clear();
ui->passEdit3->clear();
}
@@ -41,6 +41,7 @@ private slots:
void textChanged();
bool event(QEvent *event);
bool eventFilter(QObject *object, QEvent *event);
void secureClearPassFields();
};
#endif // ASKPASSPHRASEDIALOG_H

0 comments on commit a6ac37e

Please sign in to comment.