mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Add support for KDFs and cyphers to the db settings widget
This commit is contained in:
parent
33974d710a
commit
4532108678
@ -18,17 +18,28 @@
|
|||||||
#include "DatabaseSettingsWidget.h"
|
#include "DatabaseSettingsWidget.h"
|
||||||
#include "ui_DatabaseSettingsWidget.h"
|
#include "ui_DatabaseSettingsWidget.h"
|
||||||
|
|
||||||
|
#include <QList>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
|
||||||
#include "core/Database.h"
|
#include "core/Database.h"
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
#include "crypto/SymmetricCipher.h"
|
#include "crypto/SymmetricCipher.h"
|
||||||
#include "crypto/kdf/AesKdf.h"
|
|
||||||
#include "format/KeePass2.h"
|
#include "format/KeePass2.h"
|
||||||
#include "keys/CompositeKey.h"
|
#include "keys/CompositeKey.h"
|
||||||
|
#include "format/KeePass2.h"
|
||||||
|
#include "crypto/kdf/Kdf.h"
|
||||||
|
#include "MessageBox.h"
|
||||||
|
|
||||||
DatabaseSettingsWidget::DatabaseSettingsWidget(QWidget* parent)
|
DatabaseSettingsWidget::DatabaseSettingsWidget(QWidget* parent)
|
||||||
: DialogyWidget(parent)
|
: DialogyWidget(parent)
|
||||||
, m_ui(new Ui::DatabaseSettingsWidget())
|
, m_ui(new Ui::DatabaseSettingsWidget())
|
||||||
|
, m_benchmarkField(nullptr)
|
||||||
, m_db(nullptr)
|
, m_db(nullptr)
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
@ -39,7 +50,7 @@ DatabaseSettingsWidget::DatabaseSettingsWidget(QWidget* parent)
|
|||||||
m_ui->historyMaxItemsSpinBox, SLOT(setEnabled(bool)));
|
m_ui->historyMaxItemsSpinBox, SLOT(setEnabled(bool)));
|
||||||
connect(m_ui->historyMaxSizeCheckBox, SIGNAL(toggled(bool)),
|
connect(m_ui->historyMaxSizeCheckBox, SIGNAL(toggled(bool)),
|
||||||
m_ui->historyMaxSizeSpinBox, SLOT(setEnabled(bool)));
|
m_ui->historyMaxSizeSpinBox, SLOT(setEnabled(bool)));
|
||||||
connect(m_ui->transformBenchmarkButton, SIGNAL(clicked()), SLOT(transformRoundsBenchmark()));
|
connect(m_ui->kdfComboBox, SIGNAL(currentIndexChanged(int)), SLOT(changeKdf(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseSettingsWidget::~DatabaseSettingsWidget()
|
DatabaseSettingsWidget::~DatabaseSettingsWidget()
|
||||||
@ -56,8 +67,6 @@ void DatabaseSettingsWidget::load(Database* db)
|
|||||||
m_ui->dbDescriptionEdit->setText(meta->description());
|
m_ui->dbDescriptionEdit->setText(meta->description());
|
||||||
m_ui->recycleBinEnabledCheckBox->setChecked(meta->recycleBinEnabled());
|
m_ui->recycleBinEnabledCheckBox->setChecked(meta->recycleBinEnabled());
|
||||||
m_ui->defaultUsernameEdit->setText(meta->defaultUserName());
|
m_ui->defaultUsernameEdit->setText(meta->defaultUserName());
|
||||||
m_ui->AlgorithmComboBox->setCurrentIndex(SymmetricCipher::cipherToAlgorithm(m_db->cipher()));
|
|
||||||
m_ui->transformRoundsSpinBox->setValue(static_cast<AesKdf*>(m_db->kdf())->rounds());
|
|
||||||
if (meta->historyMaxItems() > -1) {
|
if (meta->historyMaxItems() > -1) {
|
||||||
m_ui->historyMaxItemsSpinBox->setValue(meta->historyMaxItems());
|
m_ui->historyMaxItemsSpinBox->setValue(meta->historyMaxItems());
|
||||||
m_ui->historyMaxItemsCheckBox->setChecked(true);
|
m_ui->historyMaxItemsCheckBox->setChecked(true);
|
||||||
@ -76,6 +85,33 @@ void DatabaseSettingsWidget::load(Database* db)
|
|||||||
m_ui->historyMaxSizeCheckBox->setChecked(false);
|
m_ui->historyMaxSizeCheckBox->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_ui->algorithmComboBox->clear();
|
||||||
|
for (QList<KeePass2::UuidNamePair>::const_iterator ciphers = KeePass2::CIPHERS.constBegin();
|
||||||
|
ciphers != KeePass2::CIPHERS.constEnd(); ++ciphers) {
|
||||||
|
KeePass2::UuidNamePair cipher = *ciphers;
|
||||||
|
m_ui->algorithmComboBox->addItem(cipher.name(), cipher.uuid().toByteArray());
|
||||||
|
}
|
||||||
|
int cipherIndex = m_ui->algorithmComboBox->findData(m_db->cipher().toByteArray());
|
||||||
|
if (cipherIndex > -1) {
|
||||||
|
m_ui->algorithmComboBox->setCurrentIndex(cipherIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool blockSignals = m_ui->kdfComboBox->signalsBlocked();
|
||||||
|
m_ui->kdfComboBox->blockSignals(true);
|
||||||
|
m_kdf.reset(m_db->kdf()->clone());
|
||||||
|
m_ui->kdfComboBox->clear();
|
||||||
|
for (QList<KeePass2::UuidNamePair>::const_iterator kdfs = KeePass2::KDFS.constBegin();
|
||||||
|
kdfs != KeePass2::KDFS.constEnd(); ++kdfs) {
|
||||||
|
KeePass2::UuidNamePair kdf = *kdfs;
|
||||||
|
m_ui->kdfComboBox->addItem(kdf.name(), kdf.uuid().toByteArray());
|
||||||
|
}
|
||||||
|
int kdfIndex = m_ui->kdfComboBox->findData(KeePass2::kdfToUuid(*m_kdf).toByteArray());
|
||||||
|
if (kdfIndex > -1) {
|
||||||
|
m_ui->kdfComboBox->setCurrentIndex(kdfIndex);
|
||||||
|
}
|
||||||
|
displayKdf(*m_kdf);
|
||||||
|
m_ui->kdfComboBox->blockSignals(blockSignals);
|
||||||
|
|
||||||
m_ui->dbNameEdit->setFocus();
|
m_ui->dbNameEdit->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,15 +122,7 @@ void DatabaseSettingsWidget::save()
|
|||||||
meta->setName(m_ui->dbNameEdit->text());
|
meta->setName(m_ui->dbNameEdit->text());
|
||||||
meta->setDescription(m_ui->dbDescriptionEdit->text());
|
meta->setDescription(m_ui->dbDescriptionEdit->text());
|
||||||
meta->setDefaultUserName(m_ui->defaultUsernameEdit->text());
|
meta->setDefaultUserName(m_ui->defaultUsernameEdit->text());
|
||||||
m_db->setCipher(SymmetricCipher::algorithmToCipher(static_cast<SymmetricCipher::Algorithm>
|
|
||||||
(m_ui->AlgorithmComboBox->currentIndex())));
|
|
||||||
meta->setRecycleBinEnabled(m_ui->recycleBinEnabledCheckBox->isChecked());
|
meta->setRecycleBinEnabled(m_ui->recycleBinEnabledCheckBox->isChecked());
|
||||||
AesKdf* kdf = static_cast<AesKdf*>(m_db->kdf());
|
|
||||||
if (static_cast<quint64>(m_ui->transformRoundsSpinBox->value()) != kdf->rounds()) {
|
|
||||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
|
||||||
kdf->setRounds(m_ui->transformRoundsSpinBox->value());
|
|
||||||
QApplication::restoreOverrideCursor();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool truncate = false;
|
bool truncate = false;
|
||||||
|
|
||||||
@ -126,6 +154,33 @@ void DatabaseSettingsWidget::save()
|
|||||||
truncateHistories();
|
truncateHistories();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_db->setCipher(Uuid(m_ui->algorithmComboBox->currentData().toByteArray()));
|
||||||
|
|
||||||
|
bool kdfValid = true;
|
||||||
|
for (int i = 0; i < m_kdfFields.size(); ++i) {
|
||||||
|
QPair<quint32, QSpinBox*> field = m_kdfFields.at(i);
|
||||||
|
kdfValid &= m_kdf->setField(field.first, static_cast<quint64>(qMax(0, field.second->value())));
|
||||||
|
if (!kdfValid) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kdfValid) {
|
||||||
|
Kdf* kdf = m_kdf.take();
|
||||||
|
bool ok = m_db->changeKdf(kdf);
|
||||||
|
if (!ok) {
|
||||||
|
MessageBox::warning(this, tr("KDF unchanged"),
|
||||||
|
tr("Failed to transform key with new KDF parameters; KDF unchanged."),
|
||||||
|
QMessageBox::Ok);
|
||||||
|
delete kdf; // m_db has not taken ownership
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MessageBox::warning(this, tr("KDF unchanged"),
|
||||||
|
tr("Invalid KDF parameters; KDF unchanged."),
|
||||||
|
QMessageBox::Ok);
|
||||||
|
}
|
||||||
|
clearKdfWidgets();
|
||||||
|
|
||||||
emit editFinished(true);
|
emit editFinished(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,11 +191,12 @@ void DatabaseSettingsWidget::reject()
|
|||||||
|
|
||||||
void DatabaseSettingsWidget::transformRoundsBenchmark()
|
void DatabaseSettingsWidget::transformRoundsBenchmark()
|
||||||
{
|
{
|
||||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
if (m_benchmarkField == nullptr) {
|
||||||
int rounds = m_db->kdf()->benchmark(1000);
|
Q_ASSERT(false);
|
||||||
if (rounds != -1) {
|
return;
|
||||||
m_ui->transformRoundsSpinBox->setValue(rounds);
|
|
||||||
}
|
}
|
||||||
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||||
|
m_benchmarkField->setValue(m_kdf->benchmark(1000));
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,3 +207,66 @@ void DatabaseSettingsWidget::truncateHistories()
|
|||||||
entry->truncateHistory();
|
entry->truncateHistory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DatabaseSettingsWidget::changeKdf(int index) {
|
||||||
|
QByteArray uuidBytes = m_ui->kdfComboBox->itemData(index).toByteArray();
|
||||||
|
if (uuidBytes.size() != Uuid::Length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Kdf* newKdf = KeePass2::uuidToKdf(Uuid(uuidBytes));
|
||||||
|
if (newKdf != nullptr) {
|
||||||
|
m_kdf.reset(newKdf);
|
||||||
|
displayKdf(*m_kdf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DatabaseSettingsWidget::displayKdf(const Kdf& kdf)
|
||||||
|
{
|
||||||
|
clearKdfWidgets();
|
||||||
|
|
||||||
|
QWidget* lastWidget = nullptr;
|
||||||
|
int columnStart = m_ui->gridLayout->columnCount();
|
||||||
|
int rowStart = m_ui->gridLayout->rowCount();
|
||||||
|
QList<Kdf::Field> fields = kdf.fields();
|
||||||
|
for (int i = 0; i < fields.size(); i++) {
|
||||||
|
const Kdf::Field& field = fields.at(i);
|
||||||
|
QLabel* label = new QLabel(QString("%1:").arg(field.name()));
|
||||||
|
QSpinBox* spinBox = new QSpinBox();
|
||||||
|
m_kdfWidgets.append(label);
|
||||||
|
m_kdfWidgets.append(spinBox);
|
||||||
|
m_kdfFields.append(QPair<quint32, QSpinBox*>(field.id(), spinBox));
|
||||||
|
spinBox->setMinimum(static_cast<qint32>(qMin(qMax(0ull, field.min()), 0x7FFFFFFFull)));
|
||||||
|
spinBox->setMaximum(static_cast<qint32>(qMin(qMax(0ull, field.max()), 0x7FFFFFFFull)));
|
||||||
|
spinBox->setValue(static_cast<qint32>(qMin(qMax(0ull, kdf.field(field.id())), 0x7FFFFFFFull)));
|
||||||
|
spinBox->setObjectName(QString("kdfParams%1").arg(i));
|
||||||
|
m_ui->gridLayout->addWidget(label, rowStart + i, columnStart - 3, Qt::AlignRight);
|
||||||
|
if (field.benchmarked()) {
|
||||||
|
Q_ASSERT(m_benchmarkField == nullptr);
|
||||||
|
QPushButton* benchBtn = new QPushButton("Benchmark");
|
||||||
|
connect(benchBtn, &QPushButton::clicked, this, &DatabaseSettingsWidget::transformRoundsBenchmark);
|
||||||
|
m_kdfWidgets.append(benchBtn);
|
||||||
|
m_ui->gridLayout->addWidget(spinBox, rowStart + i, columnStart - 2);
|
||||||
|
m_ui->gridLayout->addWidget(benchBtn, rowStart + i, columnStart - 1);
|
||||||
|
m_benchmarkField = spinBox;
|
||||||
|
lastWidget = benchBtn;
|
||||||
|
} else {
|
||||||
|
m_ui->gridLayout->addWidget(spinBox, rowStart + i, columnStart - 2, 1, 2);
|
||||||
|
lastWidget = spinBox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (lastWidget != nullptr) {
|
||||||
|
QWidget::setTabOrder(lastWidget, m_ui->buttonBox->button(QDialogButtonBox::StandardButton::Cancel));
|
||||||
|
QWidget::setTabOrder(m_ui->buttonBox->button(QDialogButtonBox::StandardButton::Cancel), m_ui->buttonBox->button(QDialogButtonBox::StandardButton::Ok));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DatabaseSettingsWidget::clearKdfWidgets()
|
||||||
|
{
|
||||||
|
m_benchmarkField = nullptr;
|
||||||
|
for (int i = 0; i < m_kdfWidgets.size(); ++i) {
|
||||||
|
m_ui->gridLayout->removeWidget(m_kdfWidgets.at(i));
|
||||||
|
m_kdfWidgets.at(i)->deleteLater();
|
||||||
|
}
|
||||||
|
m_kdfWidgets.clear();
|
||||||
|
m_kdfFields.clear();
|
||||||
|
}
|
||||||
|
@ -19,8 +19,12 @@
|
|||||||
#define KEEPASSX_DATABASESETTINGSWIDGET_H
|
#define KEEPASSX_DATABASESETTINGSWIDGET_H
|
||||||
|
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QLayout>
|
||||||
|
|
||||||
#include "gui/DialogyWidget.h"
|
#include "gui/DialogyWidget.h"
|
||||||
|
#include "crypto/kdf/Kdf.h"
|
||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
|
|
||||||
@ -45,11 +49,18 @@ private slots:
|
|||||||
void save();
|
void save();
|
||||||
void reject();
|
void reject();
|
||||||
void transformRoundsBenchmark();
|
void transformRoundsBenchmark();
|
||||||
|
void changeKdf(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void truncateHistories();
|
void truncateHistories();
|
||||||
|
void displayKdf(const Kdf& kdf);
|
||||||
|
void clearKdfWidgets();
|
||||||
|
|
||||||
const QScopedPointer<Ui::DatabaseSettingsWidget> m_ui;
|
const QScopedPointer<Ui::DatabaseSettingsWidget> m_ui;
|
||||||
|
QList<QWidget*> m_kdfWidgets;
|
||||||
|
QList<QPair<quint32, QSpinBox*>> m_kdfFields;
|
||||||
|
QSpinBox* m_benchmarkField;
|
||||||
|
QScopedPointer<Kdf> m_kdf;
|
||||||
Database* m_db;
|
Database* m_db;
|
||||||
|
|
||||||
Q_DISABLE_COPY(DatabaseSettingsWidget)
|
Q_DISABLE_COPY(DatabaseSettingsWidget)
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,2,5,1">
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,2,5,1">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="topSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -25,9 +25,9 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="0,1,0">
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="leftSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -40,52 +40,9 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="widget" native="true">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>800</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="3" column="2">
|
<item row="7" column="2" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<widget class="QComboBox" name="kdfComboBox"/>
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="transformRoundsSpinBox">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>1000000000</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="transformBenchmarkButton">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>25</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Benchmark</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" alignment="Qt::AlignRight">
|
<item row="0" column="1" alignment="Qt::AlignRight">
|
||||||
<widget class="QLabel" name="dbNameLabel">
|
<widget class="QLabel" name="dbNameLabel">
|
||||||
@ -94,33 +51,31 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QCheckBox" name="historyMaxSizeCheckBox">
|
<widget class="QCheckBox" name="historyMaxSizeCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Max. history size:</string>
|
<string>Max. history size:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1" alignment="Qt::AlignRight">
|
<item row="7" column="1" alignment="Qt::AlignRight">
|
||||||
<widget class="QLabel" name="transformRoundsLabel">
|
<widget class="QLabel" name="kdfLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Transform rounds:</string>
|
<string>Key derivation function:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QCheckBox" name="historyMaxItemsCheckBox">
|
<widget class="QCheckBox" name="historyMaxItemsCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Max. history items:</string>
|
<string>Max. history items:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2" colspan="2">
|
||||||
<widget class="QLineEdit" name="dbNameEdit"/>
|
<widget class="QLineEdit" name="dbNameEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="2">
|
<item row="4" column="2" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="historyMaxItemsSpinBox">
|
<widget class="QSpinBox" name="historyMaxItemsSpinBox">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
@ -133,21 +88,17 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="2" column="1" alignment="Qt::AlignRight">
|
||||||
</item>
|
|
||||||
<item row="4" column="1" alignment="Qt::AlignRight">
|
|
||||||
<widget class="QLabel" name="defaultUsernameLabel">
|
<widget class="QLabel" name="defaultUsernameLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Default username:</string>
|
<string>Default username:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="2" colspan="2">
|
||||||
<widget class="QLineEdit" name="dbDescriptionEdit"/>
|
<widget class="QLineEdit" name="dbDescriptionEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="2">
|
<item row="5" column="2" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="historyMaxSizeSpinBox">
|
<widget class="QSpinBox" name="historyMaxSizeSpinBox">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
@ -166,16 +117,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="3" column="2" colspan="2">
|
||||||
</item>
|
|
||||||
<item row="5" column="2">
|
|
||||||
<widget class="QCheckBox" name="recycleBinEnabledCheckBox">
|
<widget class="QCheckBox" name="recycleBinEnabledCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use recycle bin</string>
|
<string>Use recycle bin</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="2">
|
<item row="2" column="2" colspan="2">
|
||||||
<widget class="QLineEdit" name="defaultUsernameEdit">
|
<widget class="QLineEdit" name="defaultUsernameEdit">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -189,32 +138,20 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2">
|
<item row="6" column="2" colspan="2">
|
||||||
<widget class="QComboBox" name="AlgorithmComboBox">
|
<widget class="QComboBox" name="algorithmComboBox"/>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>AES: 256 Bit (default)</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="6" column="1" alignment="Qt::AlignRight">
|
||||||
<property name="text">
|
<widget class="QLabel" name="algorithmLabel">
|
||||||
<string>Twofish: 256 Bit</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1" alignment="Qt::AlignRight">
|
|
||||||
<widget class="QLabel" name="AlgorithmLabel">
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Algorithm:</string>
|
<string>Algorithm:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="rightSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -229,7 +166,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="bottomSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -253,14 +190,14 @@
|
|||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>dbNameEdit</tabstop>
|
<tabstop>dbNameEdit</tabstop>
|
||||||
<tabstop>dbDescriptionEdit</tabstop>
|
<tabstop>dbDescriptionEdit</tabstop>
|
||||||
<tabstop>transformRoundsSpinBox</tabstop>
|
|
||||||
<tabstop>transformBenchmarkButton</tabstop>
|
|
||||||
<tabstop>defaultUsernameEdit</tabstop>
|
<tabstop>defaultUsernameEdit</tabstop>
|
||||||
<tabstop>recycleBinEnabledCheckBox</tabstop>
|
<tabstop>recycleBinEnabledCheckBox</tabstop>
|
||||||
<tabstop>historyMaxItemsCheckBox</tabstop>
|
<tabstop>historyMaxItemsCheckBox</tabstop>
|
||||||
<tabstop>historyMaxItemsSpinBox</tabstop>
|
<tabstop>historyMaxItemsSpinBox</tabstop>
|
||||||
<tabstop>historyMaxSizeCheckBox</tabstop>
|
<tabstop>historyMaxSizeCheckBox</tabstop>
|
||||||
<tabstop>historyMaxSizeSpinBox</tabstop>
|
<tabstop>historyMaxSizeSpinBox</tabstop>
|
||||||
|
<tabstop>algorithmComboBox</tabstop>
|
||||||
|
<tabstop>kdfComboBox</tabstop>
|
||||||
<tabstop>buttonBox</tabstop>
|
<tabstop>buttonBox</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
#include "core/Tools.h"
|
#include "core/Tools.h"
|
||||||
#include "crypto/Crypto.h"
|
#include "crypto/Crypto.h"
|
||||||
|
#include "crypto/kdf/AesKdf.h"
|
||||||
#include "format/KeePass2Reader.h"
|
#include "format/KeePass2Reader.h"
|
||||||
#include "gui/DatabaseTabWidget.h"
|
#include "gui/DatabaseTabWidget.h"
|
||||||
#include "gui/DatabaseWidget.h"
|
#include "gui/DatabaseWidget.h"
|
||||||
@ -897,12 +898,12 @@ void TestGui::testDatabaseSettings()
|
|||||||
m_db->metadata()->setName("Save");
|
m_db->metadata()->setName("Save");
|
||||||
triggerAction("actionChangeDatabaseSettings");
|
triggerAction("actionChangeDatabaseSettings");
|
||||||
QWidget* dbSettingsWidget = m_dbWidget->findChild<QWidget*>("databaseSettingsWidget");
|
QWidget* dbSettingsWidget = m_dbWidget->findChild<QWidget*>("databaseSettingsWidget");
|
||||||
QSpinBox* transformRoundsSpinBox = dbSettingsWidget->findChild<QSpinBox*>("transformRoundsSpinBox");
|
QSpinBox* transformRoundsSpinBox = dbSettingsWidget->findChild<QSpinBox*>("kdfParams0");
|
||||||
transformRoundsSpinBox->setValue(100);
|
transformRoundsSpinBox->setValue(100);
|
||||||
QTest::keyClick(transformRoundsSpinBox, Qt::Key_Enter);
|
QTest::keyClick(transformRoundsSpinBox, Qt::Key_Enter);
|
||||||
// wait for modified timer
|
// wait for modified timer
|
||||||
QTRY_COMPARE(m_tabWidget->tabText(m_tabWidget->currentIndex()), QString("Save*"));
|
QTRY_COMPARE(m_tabWidget->tabText(m_tabWidget->currentIndex()), QString("Save*"));
|
||||||
QCOMPARE(m_db->transformRounds(), Q_UINT64_C(100));
|
QCOMPARE(static_cast<AesKdf*>(m_db->kdf())->rounds(), Q_UINT64_C(100));
|
||||||
|
|
||||||
triggerAction("actionDatabaseSave");
|
triggerAction("actionDatabaseSave");
|
||||||
QCOMPARE(m_tabWidget->tabText(m_tabWidget->currentIndex()), QString("Save"));
|
QCOMPARE(m_tabWidget->tabText(m_tabWidget->currentIndex()), QString("Save"));
|
||||||
|
Loading…
Reference in New Issue
Block a user