From 3b459813ed19f9f7a4e79b237134a749151f13b2 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Wed, 1 Jul 2020 19:16:40 -0400 Subject: [PATCH] Replace "Master Key" with "Database Credentials" Definitions: * Database Key - Cryptographic hash used to perform encrypt/decrypt of the database. * Database Credentials - User facing term to refer to the collection of Password, Key File, and/or Hardware Key used to derive the Database Key. Changes: * Remove the term "master" and "key" from the user's lexicon and clarify the code base based on the definitions above. * Clean up wording in the UI to be clearer to the end user. --- src/CMakeLists.txt | 12 ++--- src/core/Database.cpp | 34 +++++++------- src/core/Database.h | 8 ++-- src/core/Metadata.cpp | 8 ++-- src/core/Metadata.h | 10 ++--- src/fdosecrets/objects/Service.cpp | 4 +- src/fdosecrets/objects/Service.h | 2 +- .../widgets/SettingsWidgetFdoSecrets.cpp | 2 +- src/format/Kdbx3Reader.cpp | 4 +- src/format/Kdbx3Writer.cpp | 8 ++-- src/format/Kdbx4Reader.cpp | 6 +-- src/format/Kdbx4Writer.cpp | 10 ++--- src/format/KdbxXmlReader.cpp | 2 +- src/format/KdbxXmlWriter.cpp | 6 +-- src/format/KeePass1Reader.cpp | 2 +- src/gui/DatabaseOpenWidget.cpp | 22 +++++----- src/gui/DatabaseOpenWidget.h | 2 +- src/gui/DatabaseOpenWidget.ui | 2 +- src/gui/DatabaseTabWidget.cpp | 10 ++--- src/gui/DatabaseTabWidget.h | 6 +-- src/gui/DatabaseWidget.cpp | 6 +-- src/gui/DatabaseWidget.h | 4 +- src/gui/MainWindow.cpp | 14 +++--- src/gui/MainWindow.ui | 8 ++-- .../KeyComponentWidget.cpp | 0 .../KeyComponentWidget.h | 0 .../KeyComponentWidget.ui | 0 .../KeyFileEditWidget.cpp | 2 +- .../KeyFileEditWidget.h | 0 .../KeyFileEditWidget.ui | 0 .../PasswordEditWidget.cpp | 0 .../PasswordEditWidget.h | 0 .../PasswordEditWidget.ui | 0 .../YubiKeyEditWidget.cpp | 0 .../YubiKeyEditWidget.h | 0 .../YubiKeyEditWidget.ui | 0 src/gui/dbsettings/DatabaseSettingsDialog.cpp | 20 ++++----- src/gui/dbsettings/DatabaseSettingsDialog.h | 6 +-- ... => DatabaseSettingsWidgetDatabaseKey.cpp} | 44 +++++++++---------- ....h => DatabaseSettingsWidgetDatabaseKey.h} | 14 +++--- src/gui/wizard/NewDatabaseWizard.cpp | 4 +- ...p => NewDatabaseWizardPageDatabaseKey.cpp} | 16 +++---- ...y.h => NewDatabaseWizardPageDatabaseKey.h} | 14 +++--- tests/TestKeePass2Format.cpp | 6 +-- tests/gui/TestGui.cpp | 6 +-- 45 files changed, 162 insertions(+), 162 deletions(-) rename src/gui/{masterkey => databasekey}/KeyComponentWidget.cpp (100%) rename src/gui/{masterkey => databasekey}/KeyComponentWidget.h (100%) rename src/gui/{masterkey => databasekey}/KeyComponentWidget.ui (100%) rename src/gui/{masterkey => databasekey}/KeyFileEditWidget.cpp (98%) rename src/gui/{masterkey => databasekey}/KeyFileEditWidget.h (100%) rename src/gui/{masterkey => databasekey}/KeyFileEditWidget.ui (100%) rename src/gui/{masterkey => databasekey}/PasswordEditWidget.cpp (100%) rename src/gui/{masterkey => databasekey}/PasswordEditWidget.h (100%) rename src/gui/{masterkey => databasekey}/PasswordEditWidget.ui (100%) rename src/gui/{masterkey => databasekey}/YubiKeyEditWidget.cpp (100%) rename src/gui/{masterkey => databasekey}/YubiKeyEditWidget.h (100%) rename src/gui/{masterkey => databasekey}/YubiKeyEditWidget.ui (100%) rename src/gui/dbsettings/{DatabaseSettingsWidgetMasterKey.cpp => DatabaseSettingsWidgetDatabaseKey.cpp} (82%) rename src/gui/dbsettings/{DatabaseSettingsWidgetMasterKey.h => DatabaseSettingsWidgetDatabaseKey.h} (84%) rename src/gui/wizard/{NewDatabaseWizardPageMasterKey.cpp => NewDatabaseWizardPageDatabaseKey.cpp} (65%) rename src/gui/wizard/{NewDatabaseWizardPageMasterKey.h => NewDatabaseWizardPageDatabaseKey.h} (66%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8af339f1c..9aa586770 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -153,16 +153,16 @@ set(keepassx_SOURCES gui/group/EditGroupWidget.cpp gui/group/GroupModel.cpp gui/group/GroupView.cpp - gui/masterkey/KeyComponentWidget.cpp - gui/masterkey/PasswordEditWidget.cpp - gui/masterkey/YubiKeyEditWidget.cpp - gui/masterkey/KeyFileEditWidget.cpp + gui/databasekey/KeyComponentWidget.cpp + gui/databasekey/PasswordEditWidget.cpp + gui/databasekey/YubiKeyEditWidget.cpp + gui/databasekey/KeyFileEditWidget.cpp gui/dbsettings/DatabaseSettingsWidget.cpp gui/dbsettings/DatabaseSettingsDialog.cpp gui/dbsettings/DatabaseSettingsWidgetGeneral.cpp gui/dbsettings/DatabaseSettingsWidgetMetaDataSimple.cpp gui/dbsettings/DatabaseSettingsWidgetEncryption.cpp - gui/dbsettings/DatabaseSettingsWidgetMasterKey.cpp + gui/dbsettings/DatabaseSettingsWidgetDatabaseKey.cpp gui/reports/ReportsWidget.cpp gui/reports/ReportsDialog.cpp gui/reports/ReportsWidgetHealthcheck.cpp @@ -179,7 +179,7 @@ set(keepassx_SOURCES gui/wizard/NewDatabaseWizardPage.cpp gui/wizard/NewDatabaseWizardPageMetaData.cpp gui/wizard/NewDatabaseWizardPageEncryption.cpp - gui/wizard/NewDatabaseWizardPageMasterKey.cpp + gui/wizard/NewDatabaseWizardPageDatabaseKey.cpp keys/CompositeKey.cpp keys/FileKey.cpp keys/PasswordKey.cpp diff --git a/src/core/Database.cpp b/src/core/Database.cpp index d4bceed5e..a315adf96 100644 --- a/src/core/Database.cpp +++ b/src/core/Database.cpp @@ -351,7 +351,7 @@ bool Database::writeDatabase(QIODevice* device, QString* error) PasswordKey oldTransformedKey; if (m_data.key->isEmpty()) { - oldTransformedKey.setHash(m_data.transformedMasterKey->rawKey()); + oldTransformedKey.setHash(m_data.transformedDatabaseKey->rawKey()); } KeePass2Writer writer; @@ -366,7 +366,7 @@ bool Database::writeDatabase(QIODevice* device, QString* error) return false; } - QByteArray newKey = m_data.transformedMasterKey->rawKey(); + QByteArray newKey = m_data.transformedDatabaseKey->rawKey(); Q_ASSERT(!newKey.isEmpty()); Q_ASSERT(newKey != oldTransformedKey.rawKey()); if (newKey.isEmpty() || newKey == oldTransformedKey.rawKey()) { @@ -662,9 +662,9 @@ Database::CompressionAlgorithm Database::compressionAlgorithm() const return m_data.compressionAlgorithm; } -QByteArray Database::transformedMasterKey() const +QByteArray Database::transformedDatabaseKey() const { - return m_data.transformedMasterKey->rawKey(); + return m_data.transformedDatabaseKey->rawKey(); } QByteArray Database::challengeResponseKey() const @@ -723,7 +723,7 @@ bool Database::setKey(const QSharedPointer& key, if (!key) { m_data.key.reset(); - m_data.transformedMasterKey.reset(new PasswordKey()); + m_data.transformedDatabaseKey.reset(new PasswordKey()); return true; } @@ -732,28 +732,28 @@ bool Database::setKey(const QSharedPointer& key, Q_ASSERT(!m_data.kdf->seed().isEmpty()); } - PasswordKey oldTransformedMasterKey; + PasswordKey oldTransformedDatabaseKey; if (m_data.key && !m_data.key->isEmpty()) { - oldTransformedMasterKey.setHash(m_data.transformedMasterKey->rawKey()); + oldTransformedDatabaseKey.setHash(m_data.transformedDatabaseKey->rawKey()); } - QByteArray transformedMasterKey; + QByteArray transformedDatabaseKey; if (!transformKey) { - transformedMasterKey = QByteArray(oldTransformedMasterKey.rawKey()); - } else if (!key->transform(*m_data.kdf, transformedMasterKey, &m_keyError)) { + transformedDatabaseKey = QByteArray(oldTransformedDatabaseKey.rawKey()); + } else if (!key->transform(*m_data.kdf, transformedDatabaseKey, &m_keyError)) { return false; } m_data.key = key; - if (!transformedMasterKey.isEmpty()) { - m_data.transformedMasterKey->setHash(transformedMasterKey); + if (!transformedDatabaseKey.isEmpty()) { + m_data.transformedDatabaseKey->setHash(transformedDatabaseKey); } if (updateChangedTime) { - m_metadata->setMasterKeyChanged(Clock::currentDateTimeUtc()); + m_metadata->setDatabaseKeyChanged(Clock::currentDateTimeUtc()); } - if (oldTransformedMasterKey.rawKey() != m_data.transformedMasterKey->rawKey()) { + if (oldTransformedDatabaseKey.rawKey() != m_data.transformedDatabaseKey->rawKey()) { markAsModified(); } @@ -908,16 +908,16 @@ bool Database::changeKdf(const QSharedPointer& kdf) Q_ASSERT(!m_data.isReadOnly); kdf->randomizeSeed(); - QByteArray transformedMasterKey; + QByteArray transformedDatabaseKey; if (!m_data.key) { m_data.key = QSharedPointer::create(); } - if (!m_data.key->transform(*kdf, transformedMasterKey)) { + if (!m_data.key->transform(*kdf, transformedDatabaseKey)) { return false; } setKdf(kdf); - m_data.transformedMasterKey->setHash(transformedMasterKey); + m_data.transformedDatabaseKey->setHash(transformedDatabaseKey); markAsModified(); return true; diff --git a/src/core/Database.h b/src/core/Database.h index c5b7e965d..86d7e0898 100644 --- a/src/core/Database.h +++ b/src/core/Database.h @@ -130,7 +130,7 @@ public: QSharedPointer kdf() const; void setKdf(QSharedPointer kdf); bool changeKdf(const QSharedPointer& kdf); - QByteArray transformedMasterKey() const; + QByteArray transformedDatabaseKey() const; static Database* databaseByUuid(const QUuid& uuid); @@ -164,7 +164,7 @@ private: CompressionAlgorithm compressionAlgorithm = CompressionGZip; QScopedPointer masterSeed; - QScopedPointer transformedMasterKey; + QScopedPointer transformedDatabaseKey; QScopedPointer challengeResponseKey; QSharedPointer key; @@ -174,7 +174,7 @@ private: DatabaseData() : masterSeed(new PasswordKey()) - , transformedMasterKey(new PasswordKey()) + , transformedDatabaseKey(new PasswordKey()) , challengeResponseKey(new PasswordKey()) { kdf->randomizeSeed(); @@ -185,7 +185,7 @@ private: filePath.clear(); masterSeed.reset(); - transformedMasterKey.reset(); + transformedDatabaseKey.reset(); challengeResponseKey.reset(); key.reset(); diff --git a/src/core/Metadata.cpp b/src/core/Metadata.cpp index 8192bbb71..4cad498f6 100644 --- a/src/core/Metadata.cpp +++ b/src/core/Metadata.cpp @@ -251,17 +251,17 @@ const Group* Metadata::lastTopVisibleGroup() const return m_lastTopVisibleGroup; } -QDateTime Metadata::masterKeyChanged() const +QDateTime Metadata::databaseKeyChanged() const { return m_masterKeyChanged; } -int Metadata::masterKeyChangeRec() const +int Metadata::databaseKeyChangeRec() const { return m_data.masterKeyChangeRec; } -int Metadata::masterKeyChangeForce() const +int Metadata::databaseKeyChangeForce() const { return m_data.masterKeyChangeForce; } @@ -474,7 +474,7 @@ void Metadata::setLastTopVisibleGroup(Group* group) set(m_lastTopVisibleGroup, group); } -void Metadata::setMasterKeyChanged(const QDateTime& value) +void Metadata::setDatabaseKeyChanged(const QDateTime& value) { Q_ASSERT(value.timeSpec() == Qt::UTC); m_masterKeyChanged = value; diff --git a/src/core/Metadata.h b/src/core/Metadata.h index c61bfacb2..dc09b3cca 100644 --- a/src/core/Metadata.h +++ b/src/core/Metadata.h @@ -96,9 +96,9 @@ public: QDateTime entryTemplatesGroupChanged() const; const Group* lastSelectedGroup() const; const Group* lastTopVisibleGroup() const; - QDateTime masterKeyChanged() const; - int masterKeyChangeRec() const; - int masterKeyChangeForce() const; + QDateTime databaseKeyChanged() const; + int databaseKeyChangeRec() const; + int databaseKeyChangeForce() const; int historyMaxItems() const; int historyMaxSize() const; CustomData* customData(); @@ -133,7 +133,7 @@ public: void setEntryTemplatesGroupChanged(const QDateTime& value); void setLastSelectedGroup(Group* group); void setLastTopVisibleGroup(Group* group); - void setMasterKeyChanged(const QDateTime& value); + void setDatabaseKeyChanged(const QDateTime& value); void setMasterKeyChangeRec(int value); void setMasterKeyChangeForce(int value); void setHistoryMaxItems(int value); @@ -142,7 +142,7 @@ public: /* * Copy all attributes from other except: * - Group pointers/uuids - * - Master key changed date + * - Database key changed date * - Custom icons * - Custom fields * - Settings changed date diff --git a/src/fdosecrets/objects/Service.cpp b/src/fdosecrets/objects/Service.cpp index 59f086107..892ba68a4 100644 --- a/src/fdosecrets/objects/Service.cpp +++ b/src/fdosecrets/objects/Service.cpp @@ -471,14 +471,14 @@ namespace FdoSecrets return collection; } - void Service::doSwitchToChangeDatabaseSettings(DatabaseWidget* dbWidget) + void Service::doSwitchToDatabaseSettings(DatabaseWidget* dbWidget) { if (dbWidget->isLocked()) { return; } // switch selected to current m_databases->setCurrentWidget(dbWidget); - m_databases->changeDatabaseSettings(); + m_databases->showDatabaseSettings(); // open settings (switch from app settings to m_dbTabs) m_plugin->emitRequestSwitchToDatabases(); diff --git a/src/fdosecrets/objects/Service.h b/src/fdosecrets/objects/Service.h index 5de48da1c..4e0eeb0ff 100644 --- a/src/fdosecrets/objects/Service.h +++ b/src/fdosecrets/objects/Service.h @@ -110,7 +110,7 @@ namespace FdoSecrets public slots: bool doCloseDatabase(DatabaseWidget* dbWidget); Collection* doNewDatabase(); - void doSwitchToChangeDatabaseSettings(DatabaseWidget* dbWidget); + void doSwitchToDatabaseSettings(DatabaseWidget* dbWidget); /** * Async, connect to signal doneUnlockDatabaseInDialog for finish notification diff --git a/src/fdosecrets/widgets/SettingsWidgetFdoSecrets.cpp b/src/fdosecrets/widgets/SettingsWidgetFdoSecrets.cpp index 7fb971c0e..9938def17 100644 --- a/src/fdosecrets/widgets/SettingsWidgetFdoSecrets.cpp +++ b/src/fdosecrets/widgets/SettingsWidgetFdoSecrets.cpp @@ -71,7 +71,7 @@ namespace return; } auto db = m_dbWidget; - m_plugin->serviceInstance()->doSwitchToChangeDatabaseSettings(m_dbWidget); + m_plugin->serviceInstance()->doSwitchToDatabaseSettings(m_dbWidget); }); addAction(m_dbSettingsAct); diff --git a/src/format/Kdbx3Reader.cpp b/src/format/Kdbx3Reader.cpp index 002aa8af0..35244f618 100644 --- a/src/format/Kdbx3Reader.cpp +++ b/src/format/Kdbx3Reader.cpp @@ -50,7 +50,7 @@ bool Kdbx3Reader::readDatabaseImpl(QIODevice* device, bool ok = AsyncTask::runAndWaitForFuture([&] { return db->setKey(key, false); }); if (!ok) { - raiseError(tr("Unable to calculate master key")); + raiseError(tr("Unable to calculate database key")); return false; } @@ -62,7 +62,7 @@ bool Kdbx3Reader::readDatabaseImpl(QIODevice* device, CryptoHash hash(CryptoHash::Sha256); hash.addData(m_masterSeed); hash.addData(db->challengeResponseKey()); - hash.addData(db->transformedMasterKey()); + hash.addData(db->transformedDatabaseKey()); QByteArray finalKey = hash.result(); SymmetricCipher::Algorithm cipher = SymmetricCipher::cipherToAlgorithm(db->cipher()); diff --git a/src/format/Kdbx3Writer.cpp b/src/format/Kdbx3Writer.cpp index 7d492e4e7..b1c1b820a 100644 --- a/src/format/Kdbx3Writer.cpp +++ b/src/format/Kdbx3Writer.cpp @@ -47,16 +47,16 @@ bool Kdbx3Writer::writeDatabase(QIODevice* device, Database* db) } if (!db->setKey(db->key(), false, true)) { - raiseError(tr("Unable to calculate master key")); + raiseError(tr("Unable to calculate database key")); return false; } - // generate transformed master key + // generate transformed database key CryptoHash hash(CryptoHash::Sha256); hash.addData(masterSeed); hash.addData(db->challengeResponseKey()); - Q_ASSERT(!db->transformedMasterKey().isEmpty()); - hash.addData(db->transformedMasterKey()); + Q_ASSERT(!db->transformedDatabaseKey().isEmpty()); + hash.addData(db->transformedDatabaseKey()); QByteArray finalKey = hash.result(); // write header diff --git a/src/format/Kdbx4Reader.cpp b/src/format/Kdbx4Reader.cpp index f5e7382fe..baeab903c 100644 --- a/src/format/Kdbx4Reader.cpp +++ b/src/format/Kdbx4Reader.cpp @@ -50,13 +50,13 @@ bool Kdbx4Reader::readDatabaseImpl(QIODevice* device, bool ok = AsyncTask::runAndWaitForFuture([&] { return db->setKey(key, false, false); }); if (!ok) { - raiseError(tr("Unable to calculate master key: %1").arg(db->keyError())); + raiseError(tr("Unable to calculate database key: %1").arg(db->keyError())); return false; } CryptoHash hash(CryptoHash::Sha256); hash.addData(m_masterSeed); - hash.addData(db->transformedMasterKey()); + hash.addData(db->transformedDatabaseKey()); QByteArray finalKey = hash.result(); QByteArray headerSha256 = device->read(32); @@ -71,7 +71,7 @@ bool Kdbx4Reader::readDatabaseImpl(QIODevice* device, } // clang-format off - QByteArray hmacKey = KeePass2::hmacKey(m_masterSeed, db->transformedMasterKey()); + QByteArray hmacKey = KeePass2::hmacKey(m_masterSeed, db->transformedDatabaseKey()); if (headerHmac != CryptoHash::hmac(headerData, HmacBlockStream::getHmacKey(UINT64_MAX, hmacKey), CryptoHash::Sha256)) { raiseError(tr("Invalid credentials were provided, please try again.\n" "If this reoccurs, then your database file may be corrupt.") + " " + tr("(HMAC mismatch)")); diff --git a/src/format/Kdbx4Writer.cpp b/src/format/Kdbx4Writer.cpp index 57211248e..1810d9aa7 100644 --- a/src/format/Kdbx4Writer.cpp +++ b/src/format/Kdbx4Writer.cpp @@ -53,15 +53,15 @@ bool Kdbx4Writer::writeDatabase(QIODevice* device, Database* db) QByteArray endOfHeader = "\r\n\r\n"; if (!db->setKey(db->key(), false, true)) { - raiseError(tr("Unable to calculate master key: %1").arg(db->keyError())); + raiseError(tr("Unable to calculate database key: %1").arg(db->keyError())); return false; } - // generate transformed master key + // generate transformed database key CryptoHash hash(CryptoHash::Sha256); hash.addData(masterSeed); - Q_ASSERT(!db->transformedMasterKey().isEmpty()); - hash.addData(db->transformedMasterKey()); + Q_ASSERT(!db->transformedDatabaseKey().isEmpty()); + hash.addData(db->transformedDatabaseKey()); QByteArray finalKey = hash.result(); // write header @@ -109,7 +109,7 @@ bool Kdbx4Writer::writeDatabase(QIODevice* device, Database* db) QByteArray headerHash = CryptoHash::hash(headerData, CryptoHash::Sha256); // write HMAC-authenticated cipher stream - QByteArray hmacKey = KeePass2::hmacKey(masterSeed, db->transformedMasterKey()); + QByteArray hmacKey = KeePass2::hmacKey(masterSeed, db->transformedDatabaseKey()); QByteArray headerHmac = CryptoHash::hmac(headerData, HmacBlockStream::getHmacKey(UINT64_MAX, hmacKey), CryptoHash::Sha256); CHECK_RETURN_FALSE(writeData(device, headerHash)); diff --git a/src/format/KdbxXmlReader.cpp b/src/format/KdbxXmlReader.cpp index ecc4111bf..8466dde7f 100644 --- a/src/format/KdbxXmlReader.cpp +++ b/src/format/KdbxXmlReader.cpp @@ -262,7 +262,7 @@ void KdbxXmlReader::parseMeta() } else if (m_xml.name() == "Color") { m_meta->setColor(readColor()); } else if (m_xml.name() == "MasterKeyChanged") { - m_meta->setMasterKeyChanged(readDateTime()); + m_meta->setDatabaseKeyChanged(readDateTime()); } else if (m_xml.name() == "MasterKeyChangeRec") { m_meta->setMasterKeyChangeRec(readNumber()); } else if (m_xml.name() == "MasterKeyChangeForce") { diff --git a/src/format/KdbxXmlWriter.cpp b/src/format/KdbxXmlWriter.cpp index 14d920439..701c246bd 100644 --- a/src/format/KdbxXmlWriter.cpp +++ b/src/format/KdbxXmlWriter.cpp @@ -112,9 +112,9 @@ void KdbxXmlWriter::writeMetadata() writeDateTime("DefaultUserNameChanged", m_meta->defaultUserNameChanged()); writeNumber("MaintenanceHistoryDays", m_meta->maintenanceHistoryDays()); writeString("Color", m_meta->color()); - writeDateTime("MasterKeyChanged", m_meta->masterKeyChanged()); - writeNumber("MasterKeyChangeRec", m_meta->masterKeyChangeRec()); - writeNumber("MasterKeyChangeForce", m_meta->masterKeyChangeForce()); + writeDateTime("MasterKeyChanged", m_meta->databaseKeyChanged()); + writeNumber("MasterKeyChangeRec", m_meta->databaseKeyChangeRec()); + writeNumber("MasterKeyChangeForce", m_meta->databaseKeyChangeForce()); writeMemoryProtection(); writeCustomIcons(); writeBool("RecycleBinEnabled", m_meta->recycleBinEnabled()); diff --git a/src/format/KeePass1Reader.cpp b/src/format/KeePass1Reader.cpp index 0319b1b2d..80e84d8cd 100644 --- a/src/format/KeePass1Reader.cpp +++ b/src/format/KeePass1Reader.cpp @@ -242,7 +242,7 @@ KeePass1Reader::readDatabase(QIODevice* device, const QString& password, QIODevi } if (!db->setKey(key)) { - raiseError(tr("Unable to calculate master key")); + raiseError(tr("Unable to calculate database key")); return {}; } diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp index c3a780112..4dbe9dc9d 100644 --- a/src/gui/DatabaseOpenWidget.cpp +++ b/src/gui/DatabaseOpenWidget.cpp @@ -199,8 +199,8 @@ void DatabaseOpenWidget::openDatabase() { m_ui->messageWidget->hide(); - QSharedPointer masterKey = databaseKey(); - if (!masterKey) { + QSharedPointer databaseKey = buildDatabaseKey(); + if (!databaseKey) { return; } @@ -213,7 +213,7 @@ void DatabaseOpenWidget::openDatabase() QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); m_ui->passwordFormFrame->setEnabled(false); QCoreApplication::processEvents(); - bool ok = m_db->open(m_filename, masterKey, &error, false); + bool ok = m_db->open(m_filename, databaseKey, &error, false); QApplication::restoreOverrideCursor(); m_ui->passwordFormFrame->setEnabled(true); @@ -271,12 +271,12 @@ void DatabaseOpenWidget::openDatabase() } } -QSharedPointer DatabaseOpenWidget::databaseKey() +QSharedPointer DatabaseOpenWidget::buildDatabaseKey() { - auto masterKey = QSharedPointer::create(); + auto databaseKey = QSharedPointer::create(); if (!m_ui->editPassword->text().isEmpty() || m_retryUnlockWithEmptyPassword) { - masterKey->addKey(QSharedPointer::create(m_ui->editPassword->text())); + databaseKey->addKey(QSharedPointer::create(m_ui->editPassword->text())); } #ifdef WITH_XC_TOUCHID @@ -284,7 +284,7 @@ QSharedPointer DatabaseOpenWidget::databaseKey() if (m_ui->checkTouchID->isChecked() && TouchID::getInstance().isAvailable() && m_ui->editPassword->text().isEmpty()) { // clear empty password from composite key - masterKey->clear(); + databaseKey->clear(); // try to get, decrypt and use PasswordKey QSharedPointer passwordKey = TouchID::getInstance().getKey(m_filename); @@ -293,7 +293,7 @@ QSharedPointer DatabaseOpenWidget::databaseKey() if (passwordKey.isNull()) return QSharedPointer(); - masterKey->addKey(PasswordKey::fromRawKey(*passwordKey)); + databaseKey->addKey(PasswordKey::fromRawKey(*passwordKey)); } } #endif @@ -326,7 +326,7 @@ QSharedPointer DatabaseOpenWidget::databaseKey() legacyWarning.exec(); } - masterKey->addKey(key); + databaseKey->addKey(key); lastKeyFiles.insert(m_filename, keyFilename); } @@ -342,7 +342,7 @@ QSharedPointer DatabaseOpenWidget::databaseKey() if (selectionIndex > 0) { auto slot = m_ui->challengeResponseCombo->itemData(selectionIndex).value(); auto crKey = QSharedPointer(new YkChallengeResponseKey(slot)); - masterKey->addChallengeResponseKey(crKey); + databaseKey->addChallengeResponseKey(crKey); // Qt doesn't read custom types in settings so stuff into a QString lastChallengeResponse.insert(m_filename, QStringLiteral("%1:%2").arg(slot.first).arg(slot.second)); @@ -353,7 +353,7 @@ QSharedPointer DatabaseOpenWidget::databaseKey() } #endif - return masterKey; + return databaseKey; } void DatabaseOpenWidget::reject() diff --git a/src/gui/DatabaseOpenWidget.h b/src/gui/DatabaseOpenWidget.h index a7505d190..6d2b688ca 100644 --- a/src/gui/DatabaseOpenWidget.h +++ b/src/gui/DatabaseOpenWidget.h @@ -52,7 +52,7 @@ signals: protected: void showEvent(QShowEvent* event) override; void hideEvent(QHideEvent* event) override; - QSharedPointer databaseKey(); + QSharedPointer buildDatabaseKey(); const QScopedPointer m_ui; QSharedPointer m_db; diff --git a/src/gui/DatabaseOpenWidget.ui b/src/gui/DatabaseOpenWidget.ui index cd2d0b438..a7510baba 100644 --- a/src/gui/DatabaseOpenWidget.ui +++ b/src/gui/DatabaseOpenWidget.ui @@ -250,7 +250,7 @@ Qt::ClickFocus - <p>In addition to your master password, you can use a secret file to enhance the security of your database. Such a file can be generated in your database's security settings.</p><p>This is <strong>not</strong> your *.kdbx database file!<br>If you do not have a key file, leave the field empty.</p><p>Click for more information...</p> + <p>In addition to a password, you can use a secret file to enhance the security of your database. This file can be generated in your database's security settings.</p><p>This is <strong>not</strong> your *.kdbx database file!<br>If you do not have a key file, leave this field empty.</p><p>Click for more information...</p> Key file help diff --git a/src/gui/DatabaseTabWidget.cpp b/src/gui/DatabaseTabWidget.cpp index 7408c4900..34fe4db72 100644 --- a/src/gui/DatabaseTabWidget.cpp +++ b/src/gui/DatabaseTabWidget.cpp @@ -476,17 +476,17 @@ bool DatabaseTabWidget::warnOnExport() return ans == MessageBox::Yes; } -void DatabaseTabWidget::changeMasterKey() +void DatabaseTabWidget::showDatabaseSecurity() { - currentDatabaseWidget()->switchToMasterKeyChange(); + currentDatabaseWidget()->switchToDatabaseSecurity(); } -void DatabaseTabWidget::changeReports() +void DatabaseTabWidget::showDatabaseReports() { - currentDatabaseWidget()->switchToReports(); + currentDatabaseWidget()->switchToDatabaseReports(); } -void DatabaseTabWidget::changeDatabaseSettings() +void DatabaseTabWidget::showDatabaseSettings() { currentDatabaseWidget()->switchToDatabaseSettings(); } diff --git a/src/gui/DatabaseTabWidget.h b/src/gui/DatabaseTabWidget.h index 89086e5ec..e59681ea7 100644 --- a/src/gui/DatabaseTabWidget.h +++ b/src/gui/DatabaseTabWidget.h @@ -78,9 +78,9 @@ public slots: void unlockDatabaseInDialog(DatabaseWidget* dbWidget, DatabaseOpenDialog::Intent intent, const QString& filePath); void relockPendingDatabase(); - void changeMasterKey(); - void changeReports(); - void changeDatabaseSettings(); + void showDatabaseSecurity(); + void showDatabaseReports(); + void showDatabaseSettings(); void performGlobalAutoType(); void performBrowserUnlock(); diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index f0fa8049b..61f2b2163 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -1219,7 +1219,7 @@ void DatabaseWidget::entryActivationSignalReceived(Entry* entry, EntryModel::Mod } } -void DatabaseWidget::switchToReports() +void DatabaseWidget::switchToDatabaseReports() { m_reportsDialog->load(m_db); setCurrentWidget(m_reportsDialog); @@ -1307,10 +1307,10 @@ void DatabaseWidget::sortGroupsDesc() m_groupView->sortGroups(true); } -void DatabaseWidget::switchToMasterKeyChange() +void DatabaseWidget::switchToDatabaseSecurity() { switchToDatabaseSettings(); - m_databaseSettingDialog->showMasterKeySettings(); + m_databaseSettingDialog->showDatabaseKeySettings(); } void DatabaseWidget::performUnlockDatabase(const QString& password, const QString& keyfile) diff --git a/src/gui/DatabaseWidget.h b/src/gui/DatabaseWidget.h index 9243669b0..a31dfd37b 100644 --- a/src/gui/DatabaseWidget.h +++ b/src/gui/DatabaseWidget.h @@ -197,8 +197,8 @@ public slots: void switchToGroupEdit(); void sortGroupsAsc(); void sortGroupsDesc(); - void switchToMasterKeyChange(); - void switchToReports(); + void switchToDatabaseSecurity(); + void switchToDatabaseReports(); void switchToDatabaseSettings(); void switchToOpenDatabase(); void switchToOpenDatabase(const QString& filePath); diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 7fdd2600d..6336240ec 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -340,7 +340,7 @@ MainWindow::MainWindow() m_ui->actionDatabaseClose->setIcon(resources()->icon("document-close")); m_ui->actionReports->setIcon(resources()->icon("reports")); m_ui->actionDatabaseSettings->setIcon(resources()->icon("document-edit")); - m_ui->actionChangeMasterKey->setIcon(resources()->icon("database-change-key")); + m_ui->actionDatabaseSecurity->setIcon(resources()->icon("database-change-key")); m_ui->actionLockDatabases->setIcon(resources()->icon("database-lock")); m_ui->actionQuit->setIcon(resources()->icon("application-exit")); m_ui->actionDatabaseMerge->setIcon(resources()->icon("database-merge")); @@ -417,9 +417,9 @@ MainWindow::MainWindow() connect(m_ui->actionDatabaseSaveBackup, SIGNAL(triggered()), m_ui->tabWidget, SLOT(saveDatabaseBackup())); connect(m_ui->actionDatabaseClose, SIGNAL(triggered()), m_ui->tabWidget, SLOT(closeCurrentDatabaseTab())); connect(m_ui->actionDatabaseMerge, SIGNAL(triggered()), m_ui->tabWidget, SLOT(mergeDatabase())); - connect(m_ui->actionChangeMasterKey, SIGNAL(triggered()), m_ui->tabWidget, SLOT(changeMasterKey())); - connect(m_ui->actionReports, SIGNAL(triggered()), m_ui->tabWidget, SLOT(changeReports())); - connect(m_ui->actionDatabaseSettings, SIGNAL(triggered()), m_ui->tabWidget, SLOT(changeDatabaseSettings())); + connect(m_ui->actionDatabaseSecurity, SIGNAL(triggered()), m_ui->tabWidget, SLOT(showDatabaseSecurity())); + connect(m_ui->actionReports, SIGNAL(triggered()), m_ui->tabWidget, SLOT(showDatabaseReports())); + connect(m_ui->actionDatabaseSettings, SIGNAL(triggered()), m_ui->tabWidget, SLOT(showDatabaseSettings())); connect(m_ui->actionImportCsv, SIGNAL(triggered()), m_ui->tabWidget, SLOT(importCsv())); connect(m_ui->actionImportKeePass1, SIGNAL(triggered()), m_ui->tabWidget, SLOT(importKeePass1Database())); connect(m_ui->actionImportOpVault, SIGNAL(triggered()), m_ui->tabWidget, SLOT(importOpVaultDatabase())); @@ -728,7 +728,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode) m_ui->actionGroupDownloadFavicons->setVisible(!recycleBinSelected); m_ui->actionGroupDownloadFavicons->setEnabled(groupSelected && currentGroupHasEntries && !recycleBinSelected); - m_ui->actionChangeMasterKey->setEnabled(true); + m_ui->actionDatabaseSecurity->setEnabled(true); m_ui->actionReports->setEnabled(true); m_ui->actionDatabaseSettings->setEnabled(true); m_ui->actionDatabaseSave->setEnabled(m_ui->tabWidget->canSave()); @@ -784,7 +784,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode) action->setEnabled(false); } - m_ui->actionChangeMasterKey->setEnabled(false); + m_ui->actionDatabaseSecurity->setEnabled(false); m_ui->actionReports->setEnabled(false); m_ui->actionDatabaseSettings->setEnabled(false); m_ui->actionDatabaseSave->setEnabled(false); @@ -813,7 +813,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode) action->setEnabled(false); } - m_ui->actionChangeMasterKey->setEnabled(false); + m_ui->actionDatabaseSecurity->setEnabled(false); m_ui->actionReports->setEnabled(false); m_ui->actionDatabaseSettings->setEnabled(false); m_ui->actionDatabaseSave->setEnabled(false); diff --git a/src/gui/MainWindow.ui b/src/gui/MainWindow.ui index 052a5da31..737775309 100644 --- a/src/gui/MainWindow.ui +++ b/src/gui/MainWindow.ui @@ -256,7 +256,7 @@ - + @@ -565,12 +565,12 @@ Sa&ve Database As… - + false - Change Master &Key… + Database &Security… @@ -578,7 +578,7 @@ false - &Database Reports... + Database &Reports... Statistics, health check, etc. diff --git a/src/gui/masterkey/KeyComponentWidget.cpp b/src/gui/databasekey/KeyComponentWidget.cpp similarity index 100% rename from src/gui/masterkey/KeyComponentWidget.cpp rename to src/gui/databasekey/KeyComponentWidget.cpp diff --git a/src/gui/masterkey/KeyComponentWidget.h b/src/gui/databasekey/KeyComponentWidget.h similarity index 100% rename from src/gui/masterkey/KeyComponentWidget.h rename to src/gui/databasekey/KeyComponentWidget.h diff --git a/src/gui/masterkey/KeyComponentWidget.ui b/src/gui/databasekey/KeyComponentWidget.ui similarity index 100% rename from src/gui/masterkey/KeyComponentWidget.ui rename to src/gui/databasekey/KeyComponentWidget.ui diff --git a/src/gui/masterkey/KeyFileEditWidget.cpp b/src/gui/databasekey/KeyFileEditWidget.cpp similarity index 98% rename from src/gui/masterkey/KeyFileEditWidget.cpp rename to src/gui/databasekey/KeyFileEditWidget.cpp index e6b5bef49..e0486ae07 100644 --- a/src/gui/masterkey/KeyFileEditWidget.cpp +++ b/src/gui/databasekey/KeyFileEditWidget.cpp @@ -52,7 +52,7 @@ bool KeyFileEditWidget::addToCompositeKey(QSharedPointer key) tr("Legacy key file format"), tr("You are using a legacy key file format which may become\n" "unsupported in the future.\n\n" - "Please go to the master key settings and generate a new key file."), + "Generate a new key file in the database security settings."), QMessageBox::Ok); } diff --git a/src/gui/masterkey/KeyFileEditWidget.h b/src/gui/databasekey/KeyFileEditWidget.h similarity index 100% rename from src/gui/masterkey/KeyFileEditWidget.h rename to src/gui/databasekey/KeyFileEditWidget.h diff --git a/src/gui/masterkey/KeyFileEditWidget.ui b/src/gui/databasekey/KeyFileEditWidget.ui similarity index 100% rename from src/gui/masterkey/KeyFileEditWidget.ui rename to src/gui/databasekey/KeyFileEditWidget.ui diff --git a/src/gui/masterkey/PasswordEditWidget.cpp b/src/gui/databasekey/PasswordEditWidget.cpp similarity index 100% rename from src/gui/masterkey/PasswordEditWidget.cpp rename to src/gui/databasekey/PasswordEditWidget.cpp diff --git a/src/gui/masterkey/PasswordEditWidget.h b/src/gui/databasekey/PasswordEditWidget.h similarity index 100% rename from src/gui/masterkey/PasswordEditWidget.h rename to src/gui/databasekey/PasswordEditWidget.h diff --git a/src/gui/masterkey/PasswordEditWidget.ui b/src/gui/databasekey/PasswordEditWidget.ui similarity index 100% rename from src/gui/masterkey/PasswordEditWidget.ui rename to src/gui/databasekey/PasswordEditWidget.ui diff --git a/src/gui/masterkey/YubiKeyEditWidget.cpp b/src/gui/databasekey/YubiKeyEditWidget.cpp similarity index 100% rename from src/gui/masterkey/YubiKeyEditWidget.cpp rename to src/gui/databasekey/YubiKeyEditWidget.cpp diff --git a/src/gui/masterkey/YubiKeyEditWidget.h b/src/gui/databasekey/YubiKeyEditWidget.h similarity index 100% rename from src/gui/masterkey/YubiKeyEditWidget.h rename to src/gui/databasekey/YubiKeyEditWidget.h diff --git a/src/gui/masterkey/YubiKeyEditWidget.ui b/src/gui/databasekey/YubiKeyEditWidget.ui similarity index 100% rename from src/gui/masterkey/YubiKeyEditWidget.ui rename to src/gui/databasekey/YubiKeyEditWidget.ui diff --git a/src/gui/dbsettings/DatabaseSettingsDialog.cpp b/src/gui/dbsettings/DatabaseSettingsDialog.cpp index bfb7031b4..32a9b74c2 100644 --- a/src/gui/dbsettings/DatabaseSettingsDialog.cpp +++ b/src/gui/dbsettings/DatabaseSettingsDialog.cpp @@ -19,9 +19,9 @@ #include "DatabaseSettingsDialog.h" #include "ui_DatabaseSettingsDialog.h" +#include "DatabaseSettingsWidgetDatabaseKey.h" #include "DatabaseSettingsWidgetEncryption.h" #include "DatabaseSettingsWidgetGeneral.h" -#include "DatabaseSettingsWidgetMasterKey.h" #ifdef WITH_XC_BROWSER #include "DatabaseSettingsWidgetBrowser.h" #endif @@ -65,7 +65,7 @@ DatabaseSettingsDialog::DatabaseSettingsDialog(QWidget* parent) , m_ui(new Ui::DatabaseSettingsDialog()) , m_generalWidget(new DatabaseSettingsWidgetGeneral(this)) , m_securityTabWidget(new QTabWidget(this)) - , m_masterKeyWidget(new DatabaseSettingsWidgetMasterKey(this)) + , m_databaseKeyWidget(new DatabaseSettingsWidgetDatabaseKey(this)) , m_encryptionWidget(new DatabaseSettingsWidgetEncryption(this)) #ifdef WITH_XC_BROWSER , m_browserWidget(new DatabaseSettingsWidgetBrowser(this)) @@ -81,7 +81,7 @@ DatabaseSettingsDialog::DatabaseSettingsDialog(QWidget* parent) m_ui->stackedWidget->addWidget(m_generalWidget); m_ui->stackedWidget->addWidget(m_securityTabWidget); - m_securityTabWidget->addTab(m_masterKeyWidget, tr("Master Key")); + m_securityTabWidget->addTab(m_databaseKeyWidget, tr("Database Credentials")); m_securityTabWidget->addTab(m_encryptionWidget, tr("Encryption Settings")); #if defined(WITH_XC_KEESHARE) @@ -115,7 +115,7 @@ void DatabaseSettingsDialog::load(const QSharedPointer& db) { m_ui->categoryList->setCurrentCategory(0); m_generalWidget->load(db); - m_masterKeyWidget->load(db); + m_databaseKeyWidget->load(db); m_encryptionWidget->load(db); #ifdef WITH_XC_BROWSER m_browserWidget->load(db); @@ -139,9 +139,9 @@ void DatabaseSettingsDialog::addSettingsPage(IDatabaseSettingsPage* page) } /** - * Show page and tab with database master key settings. + * Show page and tab with database database key settings. */ -void DatabaseSettingsDialog::showMasterKeySettings() +void DatabaseSettingsDialog::showDatabaseKeySettings() { m_ui->categoryList->setCurrentCategory(1); m_securityTabWidget->setCurrentIndex(0); @@ -153,7 +153,7 @@ void DatabaseSettingsDialog::save() return; } - if (!m_masterKeyWidget->save()) { + if (!m_databaseKeyWidget->save()) { return; } @@ -185,7 +185,7 @@ void DatabaseSettingsDialog::pageChanged() if (Page::Security == pageIndex) { int tabIndex = m_securityTabWidget->currentIndex(); - enabled = (tabIndex == 0 && m_masterKeyWidget->hasAdvancedMode()); + enabled = (tabIndex == 0 && m_databaseKeyWidget->hasAdvancedMode()); enabled |= (tabIndex == 1 && m_encryptionWidget->hasAdvancedMode()); } @@ -198,8 +198,8 @@ void DatabaseSettingsDialog::toggleAdvancedMode(bool advanced) m_generalWidget->setAdvancedMode(advanced); } - if (m_masterKeyWidget->hasAdvancedMode()) { - m_masterKeyWidget->setAdvancedMode(advanced); + if (m_databaseKeyWidget->hasAdvancedMode()) { + m_databaseKeyWidget->setAdvancedMode(advanced); } if (m_encryptionWidget->hasAdvancedMode()) { diff --git a/src/gui/dbsettings/DatabaseSettingsDialog.h b/src/gui/dbsettings/DatabaseSettingsDialog.h index 855978f29..ba708c65b 100644 --- a/src/gui/dbsettings/DatabaseSettingsDialog.h +++ b/src/gui/dbsettings/DatabaseSettingsDialog.h @@ -28,7 +28,7 @@ class Database; class DatabaseSettingsWidgetGeneral; class DatabaseSettingsWidgetEncryption; -class DatabaseSettingsWidgetMasterKey; +class DatabaseSettingsWidgetDatabaseKey; #ifdef WITH_XC_BROWSER class DatabaseSettingsWidgetBrowser; #endif @@ -63,7 +63,7 @@ public: void load(const QSharedPointer& db); void addSettingsPage(IDatabaseSettingsPage* page); - void showMasterKeySettings(); + void showDatabaseKeySettings(); signals: void editFinished(bool accepted); @@ -85,7 +85,7 @@ private: const QScopedPointer m_ui; QPointer m_generalWidget; QPointer m_securityTabWidget; - QPointer m_masterKeyWidget; + QPointer m_databaseKeyWidget; QPointer m_encryptionWidget; #ifdef WITH_XC_BROWSER QPointer m_browserWidget; diff --git a/src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.cpp b/src/gui/dbsettings/DatabaseSettingsWidgetDatabaseKey.cpp similarity index 82% rename from src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.cpp rename to src/gui/dbsettings/DatabaseSettingsWidgetDatabaseKey.cpp index a58ee701f..2d733d06d 100644 --- a/src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.cpp +++ b/src/gui/dbsettings/DatabaseSettingsWidgetDatabaseKey.cpp @@ -15,13 +15,13 @@ * along with this program. If not, see . */ -#include "DatabaseSettingsWidgetMasterKey.h" +#include "DatabaseSettingsWidgetDatabaseKey.h" #include "core/Database.h" #include "gui/MessageBox.h" -#include "gui/masterkey/KeyFileEditWidget.h" -#include "gui/masterkey/PasswordEditWidget.h" -#include "gui/masterkey/YubiKeyEditWidget.h" +#include "gui/databasekey/KeyFileEditWidget.h" +#include "gui/databasekey/PasswordEditWidget.h" +#include "gui/databasekey/YubiKeyEditWidget.h" #include "keys/FileKey.h" #include "keys/PasswordKey.h" #include "keys/YkChallengeResponseKey.h" @@ -30,7 +30,7 @@ #include #include -DatabaseSettingsWidgetMasterKey::DatabaseSettingsWidgetMasterKey(QWidget* parent) +DatabaseSettingsWidgetDatabaseKey::DatabaseSettingsWidgetDatabaseKey(QWidget* parent) : DatabaseSettingsWidget(parent) , m_additionalKeyOptionsToggle(new QPushButton(tr("Add additional protection..."), this)) , m_additionalKeyOptions(new QWidget(this)) @@ -65,11 +65,11 @@ DatabaseSettingsWidgetMasterKey::DatabaseSettingsWidgetMasterKey(QWidget* parent setLayout(vbox); } -DatabaseSettingsWidgetMasterKey::~DatabaseSettingsWidgetMasterKey() +DatabaseSettingsWidgetDatabaseKey::~DatabaseSettingsWidgetDatabaseKey() { } -void DatabaseSettingsWidgetMasterKey::load(QSharedPointer db) +void DatabaseSettingsWidgetDatabaseKey::load(QSharedPointer db) { DatabaseSettingsWidget::load(db); @@ -107,7 +107,7 @@ void DatabaseSettingsWidgetMasterKey::load(QSharedPointer db) #endif } -void DatabaseSettingsWidgetMasterKey::initialize() +void DatabaseSettingsWidgetDatabaseKey::initialize() { bool blocked = blockSignals(true); m_passwordEditWidget->setComponentAdded(false); @@ -118,11 +118,11 @@ void DatabaseSettingsWidgetMasterKey::initialize() blockSignals(blocked); } -void DatabaseSettingsWidgetMasterKey::uninitialize() +void DatabaseSettingsWidgetDatabaseKey::uninitialize() { } -bool DatabaseSettingsWidgetMasterKey::save() +bool DatabaseSettingsWidgetDatabaseKey::save() { m_isDirty |= (m_passwordEditWidget->visiblePage() == KeyComponentWidget::Page::Edit); m_isDirty |= (m_keyFileEditWidget->visiblePage() == KeyComponentWidget::Page::Edit); @@ -202,17 +202,17 @@ bool DatabaseSettingsWidgetMasterKey::save() return true; } -void DatabaseSettingsWidgetMasterKey::discard() +void DatabaseSettingsWidgetDatabaseKey::discard() { emit editFinished(false); } -void DatabaseSettingsWidgetMasterKey::showAdditionalKeyOptions() +void DatabaseSettingsWidgetDatabaseKey::showAdditionalKeyOptions() { setAdditionalKeyOptionsVisible(true); } -void DatabaseSettingsWidgetMasterKey::setAdditionalKeyOptionsVisible(bool show) +void DatabaseSettingsWidgetDatabaseKey::setAdditionalKeyOptionsVisible(bool show) { m_additionalKeyOptionsToggle->setVisible(!show); m_additionalKeyOptions->setVisible(show); @@ -220,14 +220,14 @@ void DatabaseSettingsWidgetMasterKey::setAdditionalKeyOptionsVisible(bool show) emit sizeChanged(); } -bool DatabaseSettingsWidgetMasterKey::addToCompositeKey(KeyComponentWidget* widget, - QSharedPointer& newKey, - QSharedPointer& oldKey) +bool DatabaseSettingsWidgetDatabaseKey::addToCompositeKey(KeyComponentWidget* widget, + QSharedPointer& newKey, + QSharedPointer& oldKey) { if (widget->visiblePage() == KeyComponentWidget::Edit) { QString error = tr("Unknown error"); if (!widget->validate(error) || !widget->addToCompositeKey(newKey)) { - MessageBox::critical(this, tr("Failed to change master key"), error, MessageBox::Ok); + MessageBox::critical(this, tr("Failed to change database credentials"), error, MessageBox::Ok); return false; } } else if (widget->visiblePage() == KeyComponentWidget::LeaveOrRemove) { @@ -237,14 +237,14 @@ bool DatabaseSettingsWidgetMasterKey::addToCompositeKey(KeyComponentWidget* widg return true; } -bool DatabaseSettingsWidgetMasterKey::addToCompositeKey(KeyComponentWidget* widget, - QSharedPointer& newKey, - QSharedPointer& oldKey) +bool DatabaseSettingsWidgetDatabaseKey::addToCompositeKey(KeyComponentWidget* widget, + QSharedPointer& newKey, + QSharedPointer& oldKey) { if (widget->visiblePage() == KeyComponentWidget::Edit) { QString error = tr("Unknown error"); if (!widget->validate(error) || !widget->addToCompositeKey(newKey)) { - MessageBox::critical(this, tr("Failed to change master key"), error, MessageBox::Ok); + MessageBox::critical(this, tr("Failed to change database credentials"), error, MessageBox::Ok); return false; } } else if (widget->visiblePage() == KeyComponentWidget::LeaveOrRemove) { @@ -254,7 +254,7 @@ bool DatabaseSettingsWidgetMasterKey::addToCompositeKey(KeyComponentWidget* widg return true; } -void DatabaseSettingsWidgetMasterKey::markDirty() +void DatabaseSettingsWidgetDatabaseKey::markDirty() { m_isDirty = true; } diff --git a/src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.h b/src/gui/dbsettings/DatabaseSettingsWidgetDatabaseKey.h similarity index 84% rename from src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.h rename to src/gui/dbsettings/DatabaseSettingsWidgetDatabaseKey.h index 1a3d6ed3f..a7d90e43e 100644 --- a/src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.h +++ b/src/gui/dbsettings/DatabaseSettingsWidgetDatabaseKey.h @@ -15,8 +15,8 @@ * along with this program. If not, see . */ -#ifndef KEEPASSXC_DATABASESETTINGSPAGECHANGEMASTERKEY_H -#define KEEPASSXC_DATABASESETTINGSPAGECHANGEMASTERKEY_H +#ifndef KEEPASSXC_DATABASESETTINGSPAGECHANGEDBKEY_H +#define KEEPASSXC_DATABASESETTINGSPAGECHANGEDBKEY_H #include "DatabaseSettingsWidget.h" #include "config-keepassx.h" @@ -33,14 +33,14 @@ class KeyFileEditWidget; class YubiKeyEditWidget; class QPushButton; -class DatabaseSettingsWidgetMasterKey : public DatabaseSettingsWidget +class DatabaseSettingsWidgetDatabaseKey : public DatabaseSettingsWidget { Q_OBJECT public: - explicit DatabaseSettingsWidgetMasterKey(QWidget* parent = nullptr); - Q_DISABLE_COPY(DatabaseSettingsWidgetMasterKey); - ~DatabaseSettingsWidgetMasterKey() override; + explicit DatabaseSettingsWidgetDatabaseKey(QWidget* parent = nullptr); + Q_DISABLE_COPY(DatabaseSettingsWidgetDatabaseKey); + ~DatabaseSettingsWidgetDatabaseKey() override; void load(QSharedPointer db) override; @@ -82,4 +82,4 @@ private: #endif }; -#endif // KEEPASSXC_DATABASESETTINGSPAGECHANGEMASTERKEY_H +#endif // KEEPASSXC_DATABASESETTINGSPAGECHANGEDBKEY_H diff --git a/src/gui/wizard/NewDatabaseWizard.cpp b/src/gui/wizard/NewDatabaseWizard.cpp index c810f42ce..45ac8e46d 100644 --- a/src/gui/wizard/NewDatabaseWizard.cpp +++ b/src/gui/wizard/NewDatabaseWizard.cpp @@ -16,8 +16,8 @@ */ #include "NewDatabaseWizard.h" +#include "NewDatabaseWizardPageDatabaseKey.h" #include "NewDatabaseWizardPageEncryption.h" -#include "NewDatabaseWizardPageMasterKey.h" #include "NewDatabaseWizardPageMetaData.h" #include "core/Database.h" @@ -41,7 +41,7 @@ NewDatabaseWizard::NewDatabaseWizard(QWidget* parent) // clang-format off m_pages << new NewDatabaseWizardPageMetaData() << new NewDatabaseWizardPageEncryption() - << new NewDatabaseWizardPageMasterKey(); + << new NewDatabaseWizardPageDatabaseKey(); // clang-format on for (const auto& page : asConst(m_pages)) { diff --git a/src/gui/wizard/NewDatabaseWizardPageMasterKey.cpp b/src/gui/wizard/NewDatabaseWizardPageDatabaseKey.cpp similarity index 65% rename from src/gui/wizard/NewDatabaseWizardPageMasterKey.cpp rename to src/gui/wizard/NewDatabaseWizardPageDatabaseKey.cpp index 71bd5e60f..3180400c0 100644 --- a/src/gui/wizard/NewDatabaseWizardPageMasterKey.cpp +++ b/src/gui/wizard/NewDatabaseWizardPageDatabaseKey.cpp @@ -15,26 +15,26 @@ * along with this program. If not, see . */ -#include "NewDatabaseWizardPageMasterKey.h" -#include "gui/dbsettings/DatabaseSettingsWidgetMasterKey.h" +#include "NewDatabaseWizardPageDatabaseKey.h" +#include "gui/dbsettings/DatabaseSettingsWidgetDatabaseKey.h" #include -NewDatabaseWizardPageMasterKey::NewDatabaseWizardPageMasterKey(QWidget* parent) +NewDatabaseWizardPageDatabaseKey::NewDatabaseWizardPageDatabaseKey(QWidget* parent) : NewDatabaseWizardPage(parent) { - setPageWidget(new DatabaseSettingsWidgetMasterKey()); + setPageWidget(new DatabaseSettingsWidgetDatabaseKey()); - setTitle(tr("Database Master Key")); - setSubTitle(tr("A master key known only to you protects your database.")); + setTitle(tr("Database Credentials")); + setSubTitle(tr("A set of credentials known only to you that protects your database.")); connect(pageWidget(), SIGNAL(sizeChanged()), SLOT(updateWindowSize())); } -NewDatabaseWizardPageMasterKey::~NewDatabaseWizardPageMasterKey() +NewDatabaseWizardPageDatabaseKey::~NewDatabaseWizardPageDatabaseKey() { } -void NewDatabaseWizardPageMasterKey::updateWindowSize() +void NewDatabaseWizardPageDatabaseKey::updateWindowSize() { // ugly workaround for QWizard not managing to react to size changes automatically window()->adjustSize(); diff --git a/src/gui/wizard/NewDatabaseWizardPageMasterKey.h b/src/gui/wizard/NewDatabaseWizardPageDatabaseKey.h similarity index 66% rename from src/gui/wizard/NewDatabaseWizardPageMasterKey.h rename to src/gui/wizard/NewDatabaseWizardPageDatabaseKey.h index 3b5072846..e0fb5349e 100644 --- a/src/gui/wizard/NewDatabaseWizardPageMasterKey.h +++ b/src/gui/wizard/NewDatabaseWizardPageDatabaseKey.h @@ -15,22 +15,22 @@ * along with this program. If not, see . */ -#ifndef KEEPASSXC_NEWDATABASEWIZARDPAGEMASTERKEY_H -#define KEEPASSXC_NEWDATABASEWIZARDPAGEMASTERKEY_H +#ifndef KEEPASSXC_NEWDATABASEWIZARDPAGEDATABASEKEY_H +#define KEEPASSXC_NEWDATABASEWIZARDPAGEDATABASEKEY_H #include "NewDatabaseWizardPage.h" -class NewDatabaseWizardPageMasterKey : public NewDatabaseWizardPage +class NewDatabaseWizardPageDatabaseKey : public NewDatabaseWizardPage { Q_OBJECT public: - explicit NewDatabaseWizardPageMasterKey(QWidget* parent = nullptr); - Q_DISABLE_COPY(NewDatabaseWizardPageMasterKey); - ~NewDatabaseWizardPageMasterKey() override; + explicit NewDatabaseWizardPageDatabaseKey(QWidget* parent = nullptr); + Q_DISABLE_COPY(NewDatabaseWizardPageDatabaseKey); + ~NewDatabaseWizardPageDatabaseKey() override; private slots: void updateWindowSize(); }; -#endif // KEEPASSXC_NEWDATABASEWIZARDPAGEMASTERKEY_H +#endif // KEEPASSXC_NEWDATABASEWIZARDPAGEDATABASEKEY_H diff --git a/tests/TestKeePass2Format.cpp b/tests/TestKeePass2Format.cpp index f58d0a885..b0217c942 100644 --- a/tests/TestKeePass2Format.cpp +++ b/tests/TestKeePass2Format.cpp @@ -87,9 +87,9 @@ void TestKeePass2Format::testXmlMetadata() QCOMPARE(m_xmlDb->metadata()->defaultUserNameChanged(), MockClock::datetimeUtc(2010, 8, 8, 17, 27, 45)); QCOMPARE(m_xmlDb->metadata()->maintenanceHistoryDays(), 127); QCOMPARE(m_xmlDb->metadata()->color(), QString("#FFEF00")); - QCOMPARE(m_xmlDb->metadata()->masterKeyChanged(), MockClock::datetimeUtc(2012, 4, 5, 17, 9, 34)); - QCOMPARE(m_xmlDb->metadata()->masterKeyChangeRec(), 101); - QCOMPARE(m_xmlDb->metadata()->masterKeyChangeForce(), -1); + QCOMPARE(m_xmlDb->metadata()->databaseKeyChanged(), MockClock::datetimeUtc(2012, 4, 5, 17, 9, 34)); + QCOMPARE(m_xmlDb->metadata()->databaseKeyChangeRec(), 101); + QCOMPARE(m_xmlDb->metadata()->databaseKeyChangeForce(), -1); QCOMPARE(m_xmlDb->metadata()->protectTitle(), false); QCOMPARE(m_xmlDb->metadata()->protectUsername(), true); QCOMPARE(m_xmlDb->metadata()->protectPassword(), false); diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp index e59540a02..70417dbd5 100644 --- a/tests/gui/TestGui.cpp +++ b/tests/gui/TestGui.cpp @@ -63,15 +63,15 @@ #include "gui/SearchWidget.h" #include "gui/TotpDialog.h" #include "gui/TotpSetupDialog.h" +#include "gui/databasekey/KeyComponentWidget.h" +#include "gui/databasekey/KeyFileEditWidget.h" +#include "gui/databasekey/PasswordEditWidget.h" #include "gui/dbsettings/DatabaseSettingsDialog.h" #include "gui/entry/EditEntryWidget.h" #include "gui/entry/EntryView.h" #include "gui/group/EditGroupWidget.h" #include "gui/group/GroupModel.h" #include "gui/group/GroupView.h" -#include "gui/masterkey/KeyComponentWidget.h" -#include "gui/masterkey/KeyFileEditWidget.h" -#include "gui/masterkey/PasswordEditWidget.h" #include "gui/wizard/NewDatabaseWizard.h" #include "keys/FileKey.h" #include "keys/PasswordKey.h"