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.
This commit is contained in:
Jonathan White 2020-07-01 19:16:40 -04:00
parent 60bb593228
commit 3b459813ed
45 changed files with 162 additions and 162 deletions

View file

@ -153,16 +153,16 @@ set(keepassx_SOURCES
gui/group/EditGroupWidget.cpp gui/group/EditGroupWidget.cpp
gui/group/GroupModel.cpp gui/group/GroupModel.cpp
gui/group/GroupView.cpp gui/group/GroupView.cpp
gui/masterkey/KeyComponentWidget.cpp gui/databasekey/KeyComponentWidget.cpp
gui/masterkey/PasswordEditWidget.cpp gui/databasekey/PasswordEditWidget.cpp
gui/masterkey/YubiKeyEditWidget.cpp gui/databasekey/YubiKeyEditWidget.cpp
gui/masterkey/KeyFileEditWidget.cpp gui/databasekey/KeyFileEditWidget.cpp
gui/dbsettings/DatabaseSettingsWidget.cpp gui/dbsettings/DatabaseSettingsWidget.cpp
gui/dbsettings/DatabaseSettingsDialog.cpp gui/dbsettings/DatabaseSettingsDialog.cpp
gui/dbsettings/DatabaseSettingsWidgetGeneral.cpp gui/dbsettings/DatabaseSettingsWidgetGeneral.cpp
gui/dbsettings/DatabaseSettingsWidgetMetaDataSimple.cpp gui/dbsettings/DatabaseSettingsWidgetMetaDataSimple.cpp
gui/dbsettings/DatabaseSettingsWidgetEncryption.cpp gui/dbsettings/DatabaseSettingsWidgetEncryption.cpp
gui/dbsettings/DatabaseSettingsWidgetMasterKey.cpp gui/dbsettings/DatabaseSettingsWidgetDatabaseKey.cpp
gui/reports/ReportsWidget.cpp gui/reports/ReportsWidget.cpp
gui/reports/ReportsDialog.cpp gui/reports/ReportsDialog.cpp
gui/reports/ReportsWidgetHealthcheck.cpp gui/reports/ReportsWidgetHealthcheck.cpp
@ -179,7 +179,7 @@ set(keepassx_SOURCES
gui/wizard/NewDatabaseWizardPage.cpp gui/wizard/NewDatabaseWizardPage.cpp
gui/wizard/NewDatabaseWizardPageMetaData.cpp gui/wizard/NewDatabaseWizardPageMetaData.cpp
gui/wizard/NewDatabaseWizardPageEncryption.cpp gui/wizard/NewDatabaseWizardPageEncryption.cpp
gui/wizard/NewDatabaseWizardPageMasterKey.cpp gui/wizard/NewDatabaseWizardPageDatabaseKey.cpp
keys/CompositeKey.cpp keys/CompositeKey.cpp
keys/FileKey.cpp keys/FileKey.cpp
keys/PasswordKey.cpp keys/PasswordKey.cpp

View file

@ -351,7 +351,7 @@ bool Database::writeDatabase(QIODevice* device, QString* error)
PasswordKey oldTransformedKey; PasswordKey oldTransformedKey;
if (m_data.key->isEmpty()) { if (m_data.key->isEmpty()) {
oldTransformedKey.setHash(m_data.transformedMasterKey->rawKey()); oldTransformedKey.setHash(m_data.transformedDatabaseKey->rawKey());
} }
KeePass2Writer writer; KeePass2Writer writer;
@ -366,7 +366,7 @@ bool Database::writeDatabase(QIODevice* device, QString* error)
return false; return false;
} }
QByteArray newKey = m_data.transformedMasterKey->rawKey(); QByteArray newKey = m_data.transformedDatabaseKey->rawKey();
Q_ASSERT(!newKey.isEmpty()); Q_ASSERT(!newKey.isEmpty());
Q_ASSERT(newKey != oldTransformedKey.rawKey()); Q_ASSERT(newKey != oldTransformedKey.rawKey());
if (newKey.isEmpty() || newKey == oldTransformedKey.rawKey()) { if (newKey.isEmpty() || newKey == oldTransformedKey.rawKey()) {
@ -662,9 +662,9 @@ Database::CompressionAlgorithm Database::compressionAlgorithm() const
return m_data.compressionAlgorithm; 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 QByteArray Database::challengeResponseKey() const
@ -723,7 +723,7 @@ bool Database::setKey(const QSharedPointer<const CompositeKey>& key,
if (!key) { if (!key) {
m_data.key.reset(); m_data.key.reset();
m_data.transformedMasterKey.reset(new PasswordKey()); m_data.transformedDatabaseKey.reset(new PasswordKey());
return true; return true;
} }
@ -732,28 +732,28 @@ bool Database::setKey(const QSharedPointer<const CompositeKey>& key,
Q_ASSERT(!m_data.kdf->seed().isEmpty()); Q_ASSERT(!m_data.kdf->seed().isEmpty());
} }
PasswordKey oldTransformedMasterKey; PasswordKey oldTransformedDatabaseKey;
if (m_data.key && !m_data.key->isEmpty()) { 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) { if (!transformKey) {
transformedMasterKey = QByteArray(oldTransformedMasterKey.rawKey()); transformedDatabaseKey = QByteArray(oldTransformedDatabaseKey.rawKey());
} else if (!key->transform(*m_data.kdf, transformedMasterKey, &m_keyError)) { } else if (!key->transform(*m_data.kdf, transformedDatabaseKey, &m_keyError)) {
return false; return false;
} }
m_data.key = key; m_data.key = key;
if (!transformedMasterKey.isEmpty()) { if (!transformedDatabaseKey.isEmpty()) {
m_data.transformedMasterKey->setHash(transformedMasterKey); m_data.transformedDatabaseKey->setHash(transformedDatabaseKey);
} }
if (updateChangedTime) { 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(); markAsModified();
} }
@ -908,16 +908,16 @@ bool Database::changeKdf(const QSharedPointer<Kdf>& kdf)
Q_ASSERT(!m_data.isReadOnly); Q_ASSERT(!m_data.isReadOnly);
kdf->randomizeSeed(); kdf->randomizeSeed();
QByteArray transformedMasterKey; QByteArray transformedDatabaseKey;
if (!m_data.key) { if (!m_data.key) {
m_data.key = QSharedPointer<CompositeKey>::create(); m_data.key = QSharedPointer<CompositeKey>::create();
} }
if (!m_data.key->transform(*kdf, transformedMasterKey)) { if (!m_data.key->transform(*kdf, transformedDatabaseKey)) {
return false; return false;
} }
setKdf(kdf); setKdf(kdf);
m_data.transformedMasterKey->setHash(transformedMasterKey); m_data.transformedDatabaseKey->setHash(transformedDatabaseKey);
markAsModified(); markAsModified();
return true; return true;

View file

@ -130,7 +130,7 @@ public:
QSharedPointer<Kdf> kdf() const; QSharedPointer<Kdf> kdf() const;
void setKdf(QSharedPointer<Kdf> kdf); void setKdf(QSharedPointer<Kdf> kdf);
bool changeKdf(const QSharedPointer<Kdf>& kdf); bool changeKdf(const QSharedPointer<Kdf>& kdf);
QByteArray transformedMasterKey() const; QByteArray transformedDatabaseKey() const;
static Database* databaseByUuid(const QUuid& uuid); static Database* databaseByUuid(const QUuid& uuid);
@ -164,7 +164,7 @@ private:
CompressionAlgorithm compressionAlgorithm = CompressionGZip; CompressionAlgorithm compressionAlgorithm = CompressionGZip;
QScopedPointer<PasswordKey> masterSeed; QScopedPointer<PasswordKey> masterSeed;
QScopedPointer<PasswordKey> transformedMasterKey; QScopedPointer<PasswordKey> transformedDatabaseKey;
QScopedPointer<PasswordKey> challengeResponseKey; QScopedPointer<PasswordKey> challengeResponseKey;
QSharedPointer<const CompositeKey> key; QSharedPointer<const CompositeKey> key;
@ -174,7 +174,7 @@ private:
DatabaseData() DatabaseData()
: masterSeed(new PasswordKey()) : masterSeed(new PasswordKey())
, transformedMasterKey(new PasswordKey()) , transformedDatabaseKey(new PasswordKey())
, challengeResponseKey(new PasswordKey()) , challengeResponseKey(new PasswordKey())
{ {
kdf->randomizeSeed(); kdf->randomizeSeed();
@ -185,7 +185,7 @@ private:
filePath.clear(); filePath.clear();
masterSeed.reset(); masterSeed.reset();
transformedMasterKey.reset(); transformedDatabaseKey.reset();
challengeResponseKey.reset(); challengeResponseKey.reset();
key.reset(); key.reset();

View file

@ -251,17 +251,17 @@ const Group* Metadata::lastTopVisibleGroup() const
return m_lastTopVisibleGroup; return m_lastTopVisibleGroup;
} }
QDateTime Metadata::masterKeyChanged() const QDateTime Metadata::databaseKeyChanged() const
{ {
return m_masterKeyChanged; return m_masterKeyChanged;
} }
int Metadata::masterKeyChangeRec() const int Metadata::databaseKeyChangeRec() const
{ {
return m_data.masterKeyChangeRec; return m_data.masterKeyChangeRec;
} }
int Metadata::masterKeyChangeForce() const int Metadata::databaseKeyChangeForce() const
{ {
return m_data.masterKeyChangeForce; return m_data.masterKeyChangeForce;
} }
@ -474,7 +474,7 @@ void Metadata::setLastTopVisibleGroup(Group* group)
set(m_lastTopVisibleGroup, group); set(m_lastTopVisibleGroup, group);
} }
void Metadata::setMasterKeyChanged(const QDateTime& value) void Metadata::setDatabaseKeyChanged(const QDateTime& value)
{ {
Q_ASSERT(value.timeSpec() == Qt::UTC); Q_ASSERT(value.timeSpec() == Qt::UTC);
m_masterKeyChanged = value; m_masterKeyChanged = value;

View file

@ -96,9 +96,9 @@ public:
QDateTime entryTemplatesGroupChanged() const; QDateTime entryTemplatesGroupChanged() const;
const Group* lastSelectedGroup() const; const Group* lastSelectedGroup() const;
const Group* lastTopVisibleGroup() const; const Group* lastTopVisibleGroup() const;
QDateTime masterKeyChanged() const; QDateTime databaseKeyChanged() const;
int masterKeyChangeRec() const; int databaseKeyChangeRec() const;
int masterKeyChangeForce() const; int databaseKeyChangeForce() const;
int historyMaxItems() const; int historyMaxItems() const;
int historyMaxSize() const; int historyMaxSize() const;
CustomData* customData(); CustomData* customData();
@ -133,7 +133,7 @@ public:
void setEntryTemplatesGroupChanged(const QDateTime& value); void setEntryTemplatesGroupChanged(const QDateTime& value);
void setLastSelectedGroup(Group* group); void setLastSelectedGroup(Group* group);
void setLastTopVisibleGroup(Group* group); void setLastTopVisibleGroup(Group* group);
void setMasterKeyChanged(const QDateTime& value); void setDatabaseKeyChanged(const QDateTime& value);
void setMasterKeyChangeRec(int value); void setMasterKeyChangeRec(int value);
void setMasterKeyChangeForce(int value); void setMasterKeyChangeForce(int value);
void setHistoryMaxItems(int value); void setHistoryMaxItems(int value);
@ -142,7 +142,7 @@ public:
/* /*
* Copy all attributes from other except: * Copy all attributes from other except:
* - Group pointers/uuids * - Group pointers/uuids
* - Master key changed date * - Database key changed date
* - Custom icons * - Custom icons
* - Custom fields * - Custom fields
* - Settings changed date * - Settings changed date

View file

@ -471,14 +471,14 @@ namespace FdoSecrets
return collection; return collection;
} }
void Service::doSwitchToChangeDatabaseSettings(DatabaseWidget* dbWidget) void Service::doSwitchToDatabaseSettings(DatabaseWidget* dbWidget)
{ {
if (dbWidget->isLocked()) { if (dbWidget->isLocked()) {
return; return;
} }
// switch selected to current // switch selected to current
m_databases->setCurrentWidget(dbWidget); m_databases->setCurrentWidget(dbWidget);
m_databases->changeDatabaseSettings(); m_databases->showDatabaseSettings();
// open settings (switch from app settings to m_dbTabs) // open settings (switch from app settings to m_dbTabs)
m_plugin->emitRequestSwitchToDatabases(); m_plugin->emitRequestSwitchToDatabases();

View file

@ -110,7 +110,7 @@ namespace FdoSecrets
public slots: public slots:
bool doCloseDatabase(DatabaseWidget* dbWidget); bool doCloseDatabase(DatabaseWidget* dbWidget);
Collection* doNewDatabase(); Collection* doNewDatabase();
void doSwitchToChangeDatabaseSettings(DatabaseWidget* dbWidget); void doSwitchToDatabaseSettings(DatabaseWidget* dbWidget);
/** /**
* Async, connect to signal doneUnlockDatabaseInDialog for finish notification * Async, connect to signal doneUnlockDatabaseInDialog for finish notification

View file

@ -71,7 +71,7 @@ namespace
return; return;
} }
auto db = m_dbWidget; auto db = m_dbWidget;
m_plugin->serviceInstance()->doSwitchToChangeDatabaseSettings(m_dbWidget); m_plugin->serviceInstance()->doSwitchToDatabaseSettings(m_dbWidget);
}); });
addAction(m_dbSettingsAct); addAction(m_dbSettingsAct);

View file

@ -50,7 +50,7 @@ bool Kdbx3Reader::readDatabaseImpl(QIODevice* device,
bool ok = AsyncTask::runAndWaitForFuture([&] { return db->setKey(key, false); }); bool ok = AsyncTask::runAndWaitForFuture([&] { return db->setKey(key, false); });
if (!ok) { if (!ok) {
raiseError(tr("Unable to calculate master key")); raiseError(tr("Unable to calculate database key"));
return false; return false;
} }
@ -62,7 +62,7 @@ bool Kdbx3Reader::readDatabaseImpl(QIODevice* device,
CryptoHash hash(CryptoHash::Sha256); CryptoHash hash(CryptoHash::Sha256);
hash.addData(m_masterSeed); hash.addData(m_masterSeed);
hash.addData(db->challengeResponseKey()); hash.addData(db->challengeResponseKey());
hash.addData(db->transformedMasterKey()); hash.addData(db->transformedDatabaseKey());
QByteArray finalKey = hash.result(); QByteArray finalKey = hash.result();
SymmetricCipher::Algorithm cipher = SymmetricCipher::cipherToAlgorithm(db->cipher()); SymmetricCipher::Algorithm cipher = SymmetricCipher::cipherToAlgorithm(db->cipher());

View file

@ -47,16 +47,16 @@ bool Kdbx3Writer::writeDatabase(QIODevice* device, Database* db)
} }
if (!db->setKey(db->key(), false, true)) { if (!db->setKey(db->key(), false, true)) {
raiseError(tr("Unable to calculate master key")); raiseError(tr("Unable to calculate database key"));
return false; return false;
} }
// generate transformed master key // generate transformed database key
CryptoHash hash(CryptoHash::Sha256); CryptoHash hash(CryptoHash::Sha256);
hash.addData(masterSeed); hash.addData(masterSeed);
hash.addData(db->challengeResponseKey()); hash.addData(db->challengeResponseKey());
Q_ASSERT(!db->transformedMasterKey().isEmpty()); Q_ASSERT(!db->transformedDatabaseKey().isEmpty());
hash.addData(db->transformedMasterKey()); hash.addData(db->transformedDatabaseKey());
QByteArray finalKey = hash.result(); QByteArray finalKey = hash.result();
// write header // write header

View file

@ -50,13 +50,13 @@ bool Kdbx4Reader::readDatabaseImpl(QIODevice* device,
bool ok = AsyncTask::runAndWaitForFuture([&] { return db->setKey(key, false, false); }); bool ok = AsyncTask::runAndWaitForFuture([&] { return db->setKey(key, false, false); });
if (!ok) { 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; return false;
} }
CryptoHash hash(CryptoHash::Sha256); CryptoHash hash(CryptoHash::Sha256);
hash.addData(m_masterSeed); hash.addData(m_masterSeed);
hash.addData(db->transformedMasterKey()); hash.addData(db->transformedDatabaseKey());
QByteArray finalKey = hash.result(); QByteArray finalKey = hash.result();
QByteArray headerSha256 = device->read(32); QByteArray headerSha256 = device->read(32);
@ -71,7 +71,7 @@ bool Kdbx4Reader::readDatabaseImpl(QIODevice* device,
} }
// clang-format off // 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)) { if (headerHmac != CryptoHash::hmac(headerData, HmacBlockStream::getHmacKey(UINT64_MAX, hmacKey), CryptoHash::Sha256)) {
raiseError(tr("Invalid credentials were provided, please try again.\n" raiseError(tr("Invalid credentials were provided, please try again.\n"
"If this reoccurs, then your database file may be corrupt.") + " " + tr("(HMAC mismatch)")); "If this reoccurs, then your database file may be corrupt.") + " " + tr("(HMAC mismatch)"));

View file

@ -53,15 +53,15 @@ bool Kdbx4Writer::writeDatabase(QIODevice* device, Database* db)
QByteArray endOfHeader = "\r\n\r\n"; QByteArray endOfHeader = "\r\n\r\n";
if (!db->setKey(db->key(), false, true)) { 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; return false;
} }
// generate transformed master key // generate transformed database key
CryptoHash hash(CryptoHash::Sha256); CryptoHash hash(CryptoHash::Sha256);
hash.addData(masterSeed); hash.addData(masterSeed);
Q_ASSERT(!db->transformedMasterKey().isEmpty()); Q_ASSERT(!db->transformedDatabaseKey().isEmpty());
hash.addData(db->transformedMasterKey()); hash.addData(db->transformedDatabaseKey());
QByteArray finalKey = hash.result(); QByteArray finalKey = hash.result();
// write header // write header
@ -109,7 +109,7 @@ bool Kdbx4Writer::writeDatabase(QIODevice* device, Database* db)
QByteArray headerHash = CryptoHash::hash(headerData, CryptoHash::Sha256); QByteArray headerHash = CryptoHash::hash(headerData, CryptoHash::Sha256);
// write HMAC-authenticated cipher stream // write HMAC-authenticated cipher stream
QByteArray hmacKey = KeePass2::hmacKey(masterSeed, db->transformedMasterKey()); QByteArray hmacKey = KeePass2::hmacKey(masterSeed, db->transformedDatabaseKey());
QByteArray headerHmac = QByteArray headerHmac =
CryptoHash::hmac(headerData, HmacBlockStream::getHmacKey(UINT64_MAX, hmacKey), CryptoHash::Sha256); CryptoHash::hmac(headerData, HmacBlockStream::getHmacKey(UINT64_MAX, hmacKey), CryptoHash::Sha256);
CHECK_RETURN_FALSE(writeData(device, headerHash)); CHECK_RETURN_FALSE(writeData(device, headerHash));

View file

@ -262,7 +262,7 @@ void KdbxXmlReader::parseMeta()
} else if (m_xml.name() == "Color") { } else if (m_xml.name() == "Color") {
m_meta->setColor(readColor()); m_meta->setColor(readColor());
} else if (m_xml.name() == "MasterKeyChanged") { } else if (m_xml.name() == "MasterKeyChanged") {
m_meta->setMasterKeyChanged(readDateTime()); m_meta->setDatabaseKeyChanged(readDateTime());
} else if (m_xml.name() == "MasterKeyChangeRec") { } else if (m_xml.name() == "MasterKeyChangeRec") {
m_meta->setMasterKeyChangeRec(readNumber()); m_meta->setMasterKeyChangeRec(readNumber());
} else if (m_xml.name() == "MasterKeyChangeForce") { } else if (m_xml.name() == "MasterKeyChangeForce") {

View file

@ -112,9 +112,9 @@ void KdbxXmlWriter::writeMetadata()
writeDateTime("DefaultUserNameChanged", m_meta->defaultUserNameChanged()); writeDateTime("DefaultUserNameChanged", m_meta->defaultUserNameChanged());
writeNumber("MaintenanceHistoryDays", m_meta->maintenanceHistoryDays()); writeNumber("MaintenanceHistoryDays", m_meta->maintenanceHistoryDays());
writeString("Color", m_meta->color()); writeString("Color", m_meta->color());
writeDateTime("MasterKeyChanged", m_meta->masterKeyChanged()); writeDateTime("MasterKeyChanged", m_meta->databaseKeyChanged());
writeNumber("MasterKeyChangeRec", m_meta->masterKeyChangeRec()); writeNumber("MasterKeyChangeRec", m_meta->databaseKeyChangeRec());
writeNumber("MasterKeyChangeForce", m_meta->masterKeyChangeForce()); writeNumber("MasterKeyChangeForce", m_meta->databaseKeyChangeForce());
writeMemoryProtection(); writeMemoryProtection();
writeCustomIcons(); writeCustomIcons();
writeBool("RecycleBinEnabled", m_meta->recycleBinEnabled()); writeBool("RecycleBinEnabled", m_meta->recycleBinEnabled());

View file

@ -242,7 +242,7 @@ KeePass1Reader::readDatabase(QIODevice* device, const QString& password, QIODevi
} }
if (!db->setKey(key)) { if (!db->setKey(key)) {
raiseError(tr("Unable to calculate master key")); raiseError(tr("Unable to calculate database key"));
return {}; return {};
} }

View file

@ -199,8 +199,8 @@ void DatabaseOpenWidget::openDatabase()
{ {
m_ui->messageWidget->hide(); m_ui->messageWidget->hide();
QSharedPointer<CompositeKey> masterKey = databaseKey(); QSharedPointer<CompositeKey> databaseKey = buildDatabaseKey();
if (!masterKey) { if (!databaseKey) {
return; return;
} }
@ -213,7 +213,7 @@ void DatabaseOpenWidget::openDatabase()
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
m_ui->passwordFormFrame->setEnabled(false); m_ui->passwordFormFrame->setEnabled(false);
QCoreApplication::processEvents(); QCoreApplication::processEvents();
bool ok = m_db->open(m_filename, masterKey, &error, false); bool ok = m_db->open(m_filename, databaseKey, &error, false);
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
m_ui->passwordFormFrame->setEnabled(true); m_ui->passwordFormFrame->setEnabled(true);
@ -271,12 +271,12 @@ void DatabaseOpenWidget::openDatabase()
} }
} }
QSharedPointer<CompositeKey> DatabaseOpenWidget::databaseKey() QSharedPointer<CompositeKey> DatabaseOpenWidget::buildDatabaseKey()
{ {
auto masterKey = QSharedPointer<CompositeKey>::create(); auto databaseKey = QSharedPointer<CompositeKey>::create();
if (!m_ui->editPassword->text().isEmpty() || m_retryUnlockWithEmptyPassword) { if (!m_ui->editPassword->text().isEmpty() || m_retryUnlockWithEmptyPassword) {
masterKey->addKey(QSharedPointer<PasswordKey>::create(m_ui->editPassword->text())); databaseKey->addKey(QSharedPointer<PasswordKey>::create(m_ui->editPassword->text()));
} }
#ifdef WITH_XC_TOUCHID #ifdef WITH_XC_TOUCHID
@ -284,7 +284,7 @@ QSharedPointer<CompositeKey> DatabaseOpenWidget::databaseKey()
if (m_ui->checkTouchID->isChecked() && TouchID::getInstance().isAvailable() if (m_ui->checkTouchID->isChecked() && TouchID::getInstance().isAvailable()
&& m_ui->editPassword->text().isEmpty()) { && m_ui->editPassword->text().isEmpty()) {
// clear empty password from composite key // clear empty password from composite key
masterKey->clear(); databaseKey->clear();
// try to get, decrypt and use PasswordKey // try to get, decrypt and use PasswordKey
QSharedPointer<QByteArray> passwordKey = TouchID::getInstance().getKey(m_filename); QSharedPointer<QByteArray> passwordKey = TouchID::getInstance().getKey(m_filename);
@ -293,7 +293,7 @@ QSharedPointer<CompositeKey> DatabaseOpenWidget::databaseKey()
if (passwordKey.isNull()) if (passwordKey.isNull())
return QSharedPointer<CompositeKey>(); return QSharedPointer<CompositeKey>();
masterKey->addKey(PasswordKey::fromRawKey(*passwordKey)); databaseKey->addKey(PasswordKey::fromRawKey(*passwordKey));
} }
} }
#endif #endif
@ -326,7 +326,7 @@ QSharedPointer<CompositeKey> DatabaseOpenWidget::databaseKey()
legacyWarning.exec(); legacyWarning.exec();
} }
masterKey->addKey(key); databaseKey->addKey(key);
lastKeyFiles.insert(m_filename, keyFilename); lastKeyFiles.insert(m_filename, keyFilename);
} }
@ -342,7 +342,7 @@ QSharedPointer<CompositeKey> DatabaseOpenWidget::databaseKey()
if (selectionIndex > 0) { if (selectionIndex > 0) {
auto slot = m_ui->challengeResponseCombo->itemData(selectionIndex).value<YubiKeySlot>(); auto slot = m_ui->challengeResponseCombo->itemData(selectionIndex).value<YubiKeySlot>();
auto crKey = QSharedPointer<YkChallengeResponseKey>(new YkChallengeResponseKey(slot)); auto crKey = QSharedPointer<YkChallengeResponseKey>(new YkChallengeResponseKey(slot));
masterKey->addChallengeResponseKey(crKey); databaseKey->addChallengeResponseKey(crKey);
// Qt doesn't read custom types in settings so stuff into a QString // 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)); lastChallengeResponse.insert(m_filename, QStringLiteral("%1:%2").arg(slot.first).arg(slot.second));
@ -353,7 +353,7 @@ QSharedPointer<CompositeKey> DatabaseOpenWidget::databaseKey()
} }
#endif #endif
return masterKey; return databaseKey;
} }
void DatabaseOpenWidget::reject() void DatabaseOpenWidget::reject()

View file

@ -52,7 +52,7 @@ signals:
protected: protected:
void showEvent(QShowEvent* event) override; void showEvent(QShowEvent* event) override;
void hideEvent(QHideEvent* event) override; void hideEvent(QHideEvent* event) override;
QSharedPointer<CompositeKey> databaseKey(); QSharedPointer<CompositeKey> buildDatabaseKey();
const QScopedPointer<Ui::DatabaseOpenWidget> m_ui; const QScopedPointer<Ui::DatabaseOpenWidget> m_ui;
QSharedPointer<Database> m_db; QSharedPointer<Database> m_db;

View file

@ -250,7 +250,7 @@
<enum>Qt::ClickFocus</enum> <enum>Qt::ClickFocus</enum>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>&lt;p&gt;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.&lt;/p&gt;&lt;p&gt;This is &lt;strong&gt;not&lt;/strong&gt; your *.kdbx database file!&lt;br&gt;If you do not have a key file, leave the field empty.&lt;/p&gt;&lt;p&gt;Click for more information...&lt;/p&gt;</string> <string>&lt;p&gt;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.&lt;/p&gt;&lt;p&gt;This is &lt;strong&gt;not&lt;/strong&gt; your *.kdbx database file!&lt;br&gt;If you do not have a key file, leave this field empty.&lt;/p&gt;&lt;p&gt;Click for more information...&lt;/p&gt;</string>
</property> </property>
<property name="accessibleName"> <property name="accessibleName">
<string>Key file help</string> <string>Key file help</string>

View file

@ -476,17 +476,17 @@ bool DatabaseTabWidget::warnOnExport()
return ans == MessageBox::Yes; 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(); currentDatabaseWidget()->switchToDatabaseSettings();
} }

View file

@ -78,9 +78,9 @@ public slots:
void unlockDatabaseInDialog(DatabaseWidget* dbWidget, DatabaseOpenDialog::Intent intent, const QString& filePath); void unlockDatabaseInDialog(DatabaseWidget* dbWidget, DatabaseOpenDialog::Intent intent, const QString& filePath);
void relockPendingDatabase(); void relockPendingDatabase();
void changeMasterKey(); void showDatabaseSecurity();
void changeReports(); void showDatabaseReports();
void changeDatabaseSettings(); void showDatabaseSettings();
void performGlobalAutoType(); void performGlobalAutoType();
void performBrowserUnlock(); void performBrowserUnlock();

View file

@ -1219,7 +1219,7 @@ void DatabaseWidget::entryActivationSignalReceived(Entry* entry, EntryModel::Mod
} }
} }
void DatabaseWidget::switchToReports() void DatabaseWidget::switchToDatabaseReports()
{ {
m_reportsDialog->load(m_db); m_reportsDialog->load(m_db);
setCurrentWidget(m_reportsDialog); setCurrentWidget(m_reportsDialog);
@ -1307,10 +1307,10 @@ void DatabaseWidget::sortGroupsDesc()
m_groupView->sortGroups(true); m_groupView->sortGroups(true);
} }
void DatabaseWidget::switchToMasterKeyChange() void DatabaseWidget::switchToDatabaseSecurity()
{ {
switchToDatabaseSettings(); switchToDatabaseSettings();
m_databaseSettingDialog->showMasterKeySettings(); m_databaseSettingDialog->showDatabaseKeySettings();
} }
void DatabaseWidget::performUnlockDatabase(const QString& password, const QString& keyfile) void DatabaseWidget::performUnlockDatabase(const QString& password, const QString& keyfile)

View file

@ -197,8 +197,8 @@ public slots:
void switchToGroupEdit(); void switchToGroupEdit();
void sortGroupsAsc(); void sortGroupsAsc();
void sortGroupsDesc(); void sortGroupsDesc();
void switchToMasterKeyChange(); void switchToDatabaseSecurity();
void switchToReports(); void switchToDatabaseReports();
void switchToDatabaseSettings(); void switchToDatabaseSettings();
void switchToOpenDatabase(); void switchToOpenDatabase();
void switchToOpenDatabase(const QString& filePath); void switchToOpenDatabase(const QString& filePath);

View file

@ -340,7 +340,7 @@ MainWindow::MainWindow()
m_ui->actionDatabaseClose->setIcon(resources()->icon("document-close")); m_ui->actionDatabaseClose->setIcon(resources()->icon("document-close"));
m_ui->actionReports->setIcon(resources()->icon("reports")); m_ui->actionReports->setIcon(resources()->icon("reports"));
m_ui->actionDatabaseSettings->setIcon(resources()->icon("document-edit")); 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->actionLockDatabases->setIcon(resources()->icon("database-lock"));
m_ui->actionQuit->setIcon(resources()->icon("application-exit")); m_ui->actionQuit->setIcon(resources()->icon("application-exit"));
m_ui->actionDatabaseMerge->setIcon(resources()->icon("database-merge")); 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->actionDatabaseSaveBackup, SIGNAL(triggered()), m_ui->tabWidget, SLOT(saveDatabaseBackup()));
connect(m_ui->actionDatabaseClose, SIGNAL(triggered()), m_ui->tabWidget, SLOT(closeCurrentDatabaseTab())); 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->actionDatabaseMerge, SIGNAL(triggered()), m_ui->tabWidget, SLOT(mergeDatabase()));
connect(m_ui->actionChangeMasterKey, SIGNAL(triggered()), m_ui->tabWidget, SLOT(changeMasterKey())); connect(m_ui->actionDatabaseSecurity, SIGNAL(triggered()), m_ui->tabWidget, SLOT(showDatabaseSecurity()));
connect(m_ui->actionReports, SIGNAL(triggered()), m_ui->tabWidget, SLOT(changeReports())); connect(m_ui->actionReports, SIGNAL(triggered()), m_ui->tabWidget, SLOT(showDatabaseReports()));
connect(m_ui->actionDatabaseSettings, SIGNAL(triggered()), m_ui->tabWidget, SLOT(changeDatabaseSettings())); 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->actionImportCsv, SIGNAL(triggered()), m_ui->tabWidget, SLOT(importCsv()));
connect(m_ui->actionImportKeePass1, SIGNAL(triggered()), m_ui->tabWidget, SLOT(importKeePass1Database())); connect(m_ui->actionImportKeePass1, SIGNAL(triggered()), m_ui->tabWidget, SLOT(importKeePass1Database()));
connect(m_ui->actionImportOpVault, SIGNAL(triggered()), m_ui->tabWidget, SLOT(importOpVaultDatabase())); 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->setVisible(!recycleBinSelected);
m_ui->actionGroupDownloadFavicons->setEnabled(groupSelected && currentGroupHasEntries m_ui->actionGroupDownloadFavicons->setEnabled(groupSelected && currentGroupHasEntries
&& !recycleBinSelected); && !recycleBinSelected);
m_ui->actionChangeMasterKey->setEnabled(true); m_ui->actionDatabaseSecurity->setEnabled(true);
m_ui->actionReports->setEnabled(true); m_ui->actionReports->setEnabled(true);
m_ui->actionDatabaseSettings->setEnabled(true); m_ui->actionDatabaseSettings->setEnabled(true);
m_ui->actionDatabaseSave->setEnabled(m_ui->tabWidget->canSave()); m_ui->actionDatabaseSave->setEnabled(m_ui->tabWidget->canSave());
@ -784,7 +784,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
action->setEnabled(false); action->setEnabled(false);
} }
m_ui->actionChangeMasterKey->setEnabled(false); m_ui->actionDatabaseSecurity->setEnabled(false);
m_ui->actionReports->setEnabled(false); m_ui->actionReports->setEnabled(false);
m_ui->actionDatabaseSettings->setEnabled(false); m_ui->actionDatabaseSettings->setEnabled(false);
m_ui->actionDatabaseSave->setEnabled(false); m_ui->actionDatabaseSave->setEnabled(false);
@ -813,7 +813,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
action->setEnabled(false); action->setEnabled(false);
} }
m_ui->actionChangeMasterKey->setEnabled(false); m_ui->actionDatabaseSecurity->setEnabled(false);
m_ui->actionReports->setEnabled(false); m_ui->actionReports->setEnabled(false);
m_ui->actionDatabaseSettings->setEnabled(false); m_ui->actionDatabaseSettings->setEnabled(false);
m_ui->actionDatabaseSave->setEnabled(false); m_ui->actionDatabaseSave->setEnabled(false);

View file

@ -256,7 +256,7 @@
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionReports"/> <addaction name="actionReports"/>
<addaction name="actionDatabaseSettings"/> <addaction name="actionDatabaseSettings"/>
<addaction name="actionChangeMasterKey"/> <addaction name="actionDatabaseSecurity"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionDatabaseMerge"/> <addaction name="actionDatabaseMerge"/>
<addaction name="menuImport"/> <addaction name="menuImport"/>
@ -565,12 +565,12 @@
<string>Sa&amp;ve Database As…</string> <string>Sa&amp;ve Database As…</string>
</property> </property>
</action> </action>
<action name="actionChangeMasterKey"> <action name="actionDatabaseSecurity">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Change Master &amp;Key…</string> <string>Database &amp;Security…</string>
</property> </property>
</action> </action>
<action name="actionReports"> <action name="actionReports">
@ -578,7 +578,7 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="text"> <property name="text">
<string>&amp;Database Reports...</string> <string>Database &amp;Reports...</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Statistics, health check, etc.</string> <string>Statistics, health check, etc.</string>

View file

@ -52,7 +52,7 @@ bool KeyFileEditWidget::addToCompositeKey(QSharedPointer<CompositeKey> key)
tr("Legacy key file format"), tr("Legacy key file format"),
tr("You are using a legacy key file format which may become\n" tr("You are using a legacy key file format which may become\n"
"unsupported in the future.\n\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); QMessageBox::Ok);
} }

View file

@ -19,9 +19,9 @@
#include "DatabaseSettingsDialog.h" #include "DatabaseSettingsDialog.h"
#include "ui_DatabaseSettingsDialog.h" #include "ui_DatabaseSettingsDialog.h"
#include "DatabaseSettingsWidgetDatabaseKey.h"
#include "DatabaseSettingsWidgetEncryption.h" #include "DatabaseSettingsWidgetEncryption.h"
#include "DatabaseSettingsWidgetGeneral.h" #include "DatabaseSettingsWidgetGeneral.h"
#include "DatabaseSettingsWidgetMasterKey.h"
#ifdef WITH_XC_BROWSER #ifdef WITH_XC_BROWSER
#include "DatabaseSettingsWidgetBrowser.h" #include "DatabaseSettingsWidgetBrowser.h"
#endif #endif
@ -65,7 +65,7 @@ DatabaseSettingsDialog::DatabaseSettingsDialog(QWidget* parent)
, m_ui(new Ui::DatabaseSettingsDialog()) , m_ui(new Ui::DatabaseSettingsDialog())
, m_generalWidget(new DatabaseSettingsWidgetGeneral(this)) , m_generalWidget(new DatabaseSettingsWidgetGeneral(this))
, m_securityTabWidget(new QTabWidget(this)) , m_securityTabWidget(new QTabWidget(this))
, m_masterKeyWidget(new DatabaseSettingsWidgetMasterKey(this)) , m_databaseKeyWidget(new DatabaseSettingsWidgetDatabaseKey(this))
, m_encryptionWidget(new DatabaseSettingsWidgetEncryption(this)) , m_encryptionWidget(new DatabaseSettingsWidgetEncryption(this))
#ifdef WITH_XC_BROWSER #ifdef WITH_XC_BROWSER
, m_browserWidget(new DatabaseSettingsWidgetBrowser(this)) , m_browserWidget(new DatabaseSettingsWidgetBrowser(this))
@ -81,7 +81,7 @@ DatabaseSettingsDialog::DatabaseSettingsDialog(QWidget* parent)
m_ui->stackedWidget->addWidget(m_generalWidget); m_ui->stackedWidget->addWidget(m_generalWidget);
m_ui->stackedWidget->addWidget(m_securityTabWidget); 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")); m_securityTabWidget->addTab(m_encryptionWidget, tr("Encryption Settings"));
#if defined(WITH_XC_KEESHARE) #if defined(WITH_XC_KEESHARE)
@ -115,7 +115,7 @@ void DatabaseSettingsDialog::load(const QSharedPointer<Database>& db)
{ {
m_ui->categoryList->setCurrentCategory(0); m_ui->categoryList->setCurrentCategory(0);
m_generalWidget->load(db); m_generalWidget->load(db);
m_masterKeyWidget->load(db); m_databaseKeyWidget->load(db);
m_encryptionWidget->load(db); m_encryptionWidget->load(db);
#ifdef WITH_XC_BROWSER #ifdef WITH_XC_BROWSER
m_browserWidget->load(db); 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_ui->categoryList->setCurrentCategory(1);
m_securityTabWidget->setCurrentIndex(0); m_securityTabWidget->setCurrentIndex(0);
@ -153,7 +153,7 @@ void DatabaseSettingsDialog::save()
return; return;
} }
if (!m_masterKeyWidget->save()) { if (!m_databaseKeyWidget->save()) {
return; return;
} }
@ -185,7 +185,7 @@ void DatabaseSettingsDialog::pageChanged()
if (Page::Security == pageIndex) { if (Page::Security == pageIndex) {
int tabIndex = m_securityTabWidget->currentIndex(); int tabIndex = m_securityTabWidget->currentIndex();
enabled = (tabIndex == 0 && m_masterKeyWidget->hasAdvancedMode()); enabled = (tabIndex == 0 && m_databaseKeyWidget->hasAdvancedMode());
enabled |= (tabIndex == 1 && m_encryptionWidget->hasAdvancedMode()); enabled |= (tabIndex == 1 && m_encryptionWidget->hasAdvancedMode());
} }
@ -198,8 +198,8 @@ void DatabaseSettingsDialog::toggleAdvancedMode(bool advanced)
m_generalWidget->setAdvancedMode(advanced); m_generalWidget->setAdvancedMode(advanced);
} }
if (m_masterKeyWidget->hasAdvancedMode()) { if (m_databaseKeyWidget->hasAdvancedMode()) {
m_masterKeyWidget->setAdvancedMode(advanced); m_databaseKeyWidget->setAdvancedMode(advanced);
} }
if (m_encryptionWidget->hasAdvancedMode()) { if (m_encryptionWidget->hasAdvancedMode()) {

View file

@ -28,7 +28,7 @@
class Database; class Database;
class DatabaseSettingsWidgetGeneral; class DatabaseSettingsWidgetGeneral;
class DatabaseSettingsWidgetEncryption; class DatabaseSettingsWidgetEncryption;
class DatabaseSettingsWidgetMasterKey; class DatabaseSettingsWidgetDatabaseKey;
#ifdef WITH_XC_BROWSER #ifdef WITH_XC_BROWSER
class DatabaseSettingsWidgetBrowser; class DatabaseSettingsWidgetBrowser;
#endif #endif
@ -63,7 +63,7 @@ public:
void load(const QSharedPointer<Database>& db); void load(const QSharedPointer<Database>& db);
void addSettingsPage(IDatabaseSettingsPage* page); void addSettingsPage(IDatabaseSettingsPage* page);
void showMasterKeySettings(); void showDatabaseKeySettings();
signals: signals:
void editFinished(bool accepted); void editFinished(bool accepted);
@ -85,7 +85,7 @@ private:
const QScopedPointer<Ui::DatabaseSettingsDialog> m_ui; const QScopedPointer<Ui::DatabaseSettingsDialog> m_ui;
QPointer<DatabaseSettingsWidgetGeneral> m_generalWidget; QPointer<DatabaseSettingsWidgetGeneral> m_generalWidget;
QPointer<QTabWidget> m_securityTabWidget; QPointer<QTabWidget> m_securityTabWidget;
QPointer<DatabaseSettingsWidgetMasterKey> m_masterKeyWidget; QPointer<DatabaseSettingsWidgetDatabaseKey> m_databaseKeyWidget;
QPointer<DatabaseSettingsWidgetEncryption> m_encryptionWidget; QPointer<DatabaseSettingsWidgetEncryption> m_encryptionWidget;
#ifdef WITH_XC_BROWSER #ifdef WITH_XC_BROWSER
QPointer<DatabaseSettingsWidgetBrowser> m_browserWidget; QPointer<DatabaseSettingsWidgetBrowser> m_browserWidget;

View file

@ -15,13 +15,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "DatabaseSettingsWidgetMasterKey.h" #include "DatabaseSettingsWidgetDatabaseKey.h"
#include "core/Database.h" #include "core/Database.h"
#include "gui/MessageBox.h" #include "gui/MessageBox.h"
#include "gui/masterkey/KeyFileEditWidget.h" #include "gui/databasekey/KeyFileEditWidget.h"
#include "gui/masterkey/PasswordEditWidget.h" #include "gui/databasekey/PasswordEditWidget.h"
#include "gui/masterkey/YubiKeyEditWidget.h" #include "gui/databasekey/YubiKeyEditWidget.h"
#include "keys/FileKey.h" #include "keys/FileKey.h"
#include "keys/PasswordKey.h" #include "keys/PasswordKey.h"
#include "keys/YkChallengeResponseKey.h" #include "keys/YkChallengeResponseKey.h"
@ -30,7 +30,7 @@
#include <QSpacerItem> #include <QSpacerItem>
#include <QVBoxLayout> #include <QVBoxLayout>
DatabaseSettingsWidgetMasterKey::DatabaseSettingsWidgetMasterKey(QWidget* parent) DatabaseSettingsWidgetDatabaseKey::DatabaseSettingsWidgetDatabaseKey(QWidget* parent)
: DatabaseSettingsWidget(parent) : DatabaseSettingsWidget(parent)
, m_additionalKeyOptionsToggle(new QPushButton(tr("Add additional protection..."), this)) , m_additionalKeyOptionsToggle(new QPushButton(tr("Add additional protection..."), this))
, m_additionalKeyOptions(new QWidget(this)) , m_additionalKeyOptions(new QWidget(this))
@ -65,11 +65,11 @@ DatabaseSettingsWidgetMasterKey::DatabaseSettingsWidgetMasterKey(QWidget* parent
setLayout(vbox); setLayout(vbox);
} }
DatabaseSettingsWidgetMasterKey::~DatabaseSettingsWidgetMasterKey() DatabaseSettingsWidgetDatabaseKey::~DatabaseSettingsWidgetDatabaseKey()
{ {
} }
void DatabaseSettingsWidgetMasterKey::load(QSharedPointer<Database> db) void DatabaseSettingsWidgetDatabaseKey::load(QSharedPointer<Database> db)
{ {
DatabaseSettingsWidget::load(db); DatabaseSettingsWidget::load(db);
@ -107,7 +107,7 @@ void DatabaseSettingsWidgetMasterKey::load(QSharedPointer<Database> db)
#endif #endif
} }
void DatabaseSettingsWidgetMasterKey::initialize() void DatabaseSettingsWidgetDatabaseKey::initialize()
{ {
bool blocked = blockSignals(true); bool blocked = blockSignals(true);
m_passwordEditWidget->setComponentAdded(false); m_passwordEditWidget->setComponentAdded(false);
@ -118,11 +118,11 @@ void DatabaseSettingsWidgetMasterKey::initialize()
blockSignals(blocked); 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_passwordEditWidget->visiblePage() == KeyComponentWidget::Page::Edit);
m_isDirty |= (m_keyFileEditWidget->visiblePage() == KeyComponentWidget::Page::Edit); m_isDirty |= (m_keyFileEditWidget->visiblePage() == KeyComponentWidget::Page::Edit);
@ -202,17 +202,17 @@ bool DatabaseSettingsWidgetMasterKey::save()
return true; return true;
} }
void DatabaseSettingsWidgetMasterKey::discard() void DatabaseSettingsWidgetDatabaseKey::discard()
{ {
emit editFinished(false); emit editFinished(false);
} }
void DatabaseSettingsWidgetMasterKey::showAdditionalKeyOptions() void DatabaseSettingsWidgetDatabaseKey::showAdditionalKeyOptions()
{ {
setAdditionalKeyOptionsVisible(true); setAdditionalKeyOptionsVisible(true);
} }
void DatabaseSettingsWidgetMasterKey::setAdditionalKeyOptionsVisible(bool show) void DatabaseSettingsWidgetDatabaseKey::setAdditionalKeyOptionsVisible(bool show)
{ {
m_additionalKeyOptionsToggle->setVisible(!show); m_additionalKeyOptionsToggle->setVisible(!show);
m_additionalKeyOptions->setVisible(show); m_additionalKeyOptions->setVisible(show);
@ -220,14 +220,14 @@ void DatabaseSettingsWidgetMasterKey::setAdditionalKeyOptionsVisible(bool show)
emit sizeChanged(); emit sizeChanged();
} }
bool DatabaseSettingsWidgetMasterKey::addToCompositeKey(KeyComponentWidget* widget, bool DatabaseSettingsWidgetDatabaseKey::addToCompositeKey(KeyComponentWidget* widget,
QSharedPointer<CompositeKey>& newKey, QSharedPointer<CompositeKey>& newKey,
QSharedPointer<Key>& oldKey) QSharedPointer<Key>& oldKey)
{ {
if (widget->visiblePage() == KeyComponentWidget::Edit) { if (widget->visiblePage() == KeyComponentWidget::Edit) {
QString error = tr("Unknown error"); QString error = tr("Unknown error");
if (!widget->validate(error) || !widget->addToCompositeKey(newKey)) { 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; return false;
} }
} else if (widget->visiblePage() == KeyComponentWidget::LeaveOrRemove) { } else if (widget->visiblePage() == KeyComponentWidget::LeaveOrRemove) {
@ -237,14 +237,14 @@ bool DatabaseSettingsWidgetMasterKey::addToCompositeKey(KeyComponentWidget* widg
return true; return true;
} }
bool DatabaseSettingsWidgetMasterKey::addToCompositeKey(KeyComponentWidget* widget, bool DatabaseSettingsWidgetDatabaseKey::addToCompositeKey(KeyComponentWidget* widget,
QSharedPointer<CompositeKey>& newKey, QSharedPointer<CompositeKey>& newKey,
QSharedPointer<ChallengeResponseKey>& oldKey) QSharedPointer<ChallengeResponseKey>& oldKey)
{ {
if (widget->visiblePage() == KeyComponentWidget::Edit) { if (widget->visiblePage() == KeyComponentWidget::Edit) {
QString error = tr("Unknown error"); QString error = tr("Unknown error");
if (!widget->validate(error) || !widget->addToCompositeKey(newKey)) { 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; return false;
} }
} else if (widget->visiblePage() == KeyComponentWidget::LeaveOrRemove) { } else if (widget->visiblePage() == KeyComponentWidget::LeaveOrRemove) {
@ -254,7 +254,7 @@ bool DatabaseSettingsWidgetMasterKey::addToCompositeKey(KeyComponentWidget* widg
return true; return true;
} }
void DatabaseSettingsWidgetMasterKey::markDirty() void DatabaseSettingsWidgetDatabaseKey::markDirty()
{ {
m_isDirty = true; m_isDirty = true;
} }

View file

@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef KEEPASSXC_DATABASESETTINGSPAGECHANGEMASTERKEY_H #ifndef KEEPASSXC_DATABASESETTINGSPAGECHANGEDBKEY_H
#define KEEPASSXC_DATABASESETTINGSPAGECHANGEMASTERKEY_H #define KEEPASSXC_DATABASESETTINGSPAGECHANGEDBKEY_H
#include "DatabaseSettingsWidget.h" #include "DatabaseSettingsWidget.h"
#include "config-keepassx.h" #include "config-keepassx.h"
@ -33,14 +33,14 @@ class KeyFileEditWidget;
class YubiKeyEditWidget; class YubiKeyEditWidget;
class QPushButton; class QPushButton;
class DatabaseSettingsWidgetMasterKey : public DatabaseSettingsWidget class DatabaseSettingsWidgetDatabaseKey : public DatabaseSettingsWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DatabaseSettingsWidgetMasterKey(QWidget* parent = nullptr); explicit DatabaseSettingsWidgetDatabaseKey(QWidget* parent = nullptr);
Q_DISABLE_COPY(DatabaseSettingsWidgetMasterKey); Q_DISABLE_COPY(DatabaseSettingsWidgetDatabaseKey);
~DatabaseSettingsWidgetMasterKey() override; ~DatabaseSettingsWidgetDatabaseKey() override;
void load(QSharedPointer<Database> db) override; void load(QSharedPointer<Database> db) override;
@ -82,4 +82,4 @@ private:
#endif #endif
}; };
#endif // KEEPASSXC_DATABASESETTINGSPAGECHANGEMASTERKEY_H #endif // KEEPASSXC_DATABASESETTINGSPAGECHANGEDBKEY_H

View file

@ -16,8 +16,8 @@
*/ */
#include "NewDatabaseWizard.h" #include "NewDatabaseWizard.h"
#include "NewDatabaseWizardPageDatabaseKey.h"
#include "NewDatabaseWizardPageEncryption.h" #include "NewDatabaseWizardPageEncryption.h"
#include "NewDatabaseWizardPageMasterKey.h"
#include "NewDatabaseWizardPageMetaData.h" #include "NewDatabaseWizardPageMetaData.h"
#include "core/Database.h" #include "core/Database.h"
@ -41,7 +41,7 @@ NewDatabaseWizard::NewDatabaseWizard(QWidget* parent)
// clang-format off // clang-format off
m_pages << new NewDatabaseWizardPageMetaData() m_pages << new NewDatabaseWizardPageMetaData()
<< new NewDatabaseWizardPageEncryption() << new NewDatabaseWizardPageEncryption()
<< new NewDatabaseWizardPageMasterKey(); << new NewDatabaseWizardPageDatabaseKey();
// clang-format on // clang-format on
for (const auto& page : asConst(m_pages)) { for (const auto& page : asConst(m_pages)) {

View file

@ -15,26 +15,26 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "NewDatabaseWizardPageMasterKey.h" #include "NewDatabaseWizardPageDatabaseKey.h"
#include "gui/dbsettings/DatabaseSettingsWidgetMasterKey.h" #include "gui/dbsettings/DatabaseSettingsWidgetDatabaseKey.h"
#include <QApplication> #include <QApplication>
NewDatabaseWizardPageMasterKey::NewDatabaseWizardPageMasterKey(QWidget* parent) NewDatabaseWizardPageDatabaseKey::NewDatabaseWizardPageDatabaseKey(QWidget* parent)
: NewDatabaseWizardPage(parent) : NewDatabaseWizardPage(parent)
{ {
setPageWidget(new DatabaseSettingsWidgetMasterKey()); setPageWidget(new DatabaseSettingsWidgetDatabaseKey());
setTitle(tr("Database Master Key")); setTitle(tr("Database Credentials"));
setSubTitle(tr("A master key known only to you protects your database.")); setSubTitle(tr("A set of credentials known only to you that protects your database."));
connect(pageWidget(), SIGNAL(sizeChanged()), SLOT(updateWindowSize())); 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 // ugly workaround for QWizard not managing to react to size changes automatically
window()->adjustSize(); window()->adjustSize();

View file

@ -15,22 +15,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef KEEPASSXC_NEWDATABASEWIZARDPAGEMASTERKEY_H #ifndef KEEPASSXC_NEWDATABASEWIZARDPAGEDATABASEKEY_H
#define KEEPASSXC_NEWDATABASEWIZARDPAGEMASTERKEY_H #define KEEPASSXC_NEWDATABASEWIZARDPAGEDATABASEKEY_H
#include "NewDatabaseWizardPage.h" #include "NewDatabaseWizardPage.h"
class NewDatabaseWizardPageMasterKey : public NewDatabaseWizardPage class NewDatabaseWizardPageDatabaseKey : public NewDatabaseWizardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit NewDatabaseWizardPageMasterKey(QWidget* parent = nullptr); explicit NewDatabaseWizardPageDatabaseKey(QWidget* parent = nullptr);
Q_DISABLE_COPY(NewDatabaseWizardPageMasterKey); Q_DISABLE_COPY(NewDatabaseWizardPageDatabaseKey);
~NewDatabaseWizardPageMasterKey() override; ~NewDatabaseWizardPageDatabaseKey() override;
private slots: private slots:
void updateWindowSize(); void updateWindowSize();
}; };
#endif // KEEPASSXC_NEWDATABASEWIZARDPAGEMASTERKEY_H #endif // KEEPASSXC_NEWDATABASEWIZARDPAGEDATABASEKEY_H

View file

@ -87,9 +87,9 @@ void TestKeePass2Format::testXmlMetadata()
QCOMPARE(m_xmlDb->metadata()->defaultUserNameChanged(), MockClock::datetimeUtc(2010, 8, 8, 17, 27, 45)); QCOMPARE(m_xmlDb->metadata()->defaultUserNameChanged(), MockClock::datetimeUtc(2010, 8, 8, 17, 27, 45));
QCOMPARE(m_xmlDb->metadata()->maintenanceHistoryDays(), 127); QCOMPARE(m_xmlDb->metadata()->maintenanceHistoryDays(), 127);
QCOMPARE(m_xmlDb->metadata()->color(), QString("#FFEF00")); QCOMPARE(m_xmlDb->metadata()->color(), QString("#FFEF00"));
QCOMPARE(m_xmlDb->metadata()->masterKeyChanged(), MockClock::datetimeUtc(2012, 4, 5, 17, 9, 34)); QCOMPARE(m_xmlDb->metadata()->databaseKeyChanged(), MockClock::datetimeUtc(2012, 4, 5, 17, 9, 34));
QCOMPARE(m_xmlDb->metadata()->masterKeyChangeRec(), 101); QCOMPARE(m_xmlDb->metadata()->databaseKeyChangeRec(), 101);
QCOMPARE(m_xmlDb->metadata()->masterKeyChangeForce(), -1); QCOMPARE(m_xmlDb->metadata()->databaseKeyChangeForce(), -1);
QCOMPARE(m_xmlDb->metadata()->protectTitle(), false); QCOMPARE(m_xmlDb->metadata()->protectTitle(), false);
QCOMPARE(m_xmlDb->metadata()->protectUsername(), true); QCOMPARE(m_xmlDb->metadata()->protectUsername(), true);
QCOMPARE(m_xmlDb->metadata()->protectPassword(), false); QCOMPARE(m_xmlDb->metadata()->protectPassword(), false);

View file

@ -63,15 +63,15 @@
#include "gui/SearchWidget.h" #include "gui/SearchWidget.h"
#include "gui/TotpDialog.h" #include "gui/TotpDialog.h"
#include "gui/TotpSetupDialog.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/dbsettings/DatabaseSettingsDialog.h"
#include "gui/entry/EditEntryWidget.h" #include "gui/entry/EditEntryWidget.h"
#include "gui/entry/EntryView.h" #include "gui/entry/EntryView.h"
#include "gui/group/EditGroupWidget.h" #include "gui/group/EditGroupWidget.h"
#include "gui/group/GroupModel.h" #include "gui/group/GroupModel.h"
#include "gui/group/GroupView.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 "gui/wizard/NewDatabaseWizard.h"
#include "keys/FileKey.h" #include "keys/FileKey.h"
#include "keys/PasswordKey.h" #include "keys/PasswordKey.h"