Add a new database settings wizard

This patch implements a new database wizard to guide users through the process
of setting up a new database and choosing sane encryption settings.

It also reimplements the master key settings to be more
user-friendly. Users can now add, change, or remove individual composite
key components instead of having to set all components at once. This
avoids confusion about a password being reset if the user only wants to
add a key file.

With these changes comes a major refactor of how database composite keys and key
components are handled. Copying of keys is prohibited and each key
exists only once in memory and is referenced via shared pointers. GUI
components for changing individual keys are encapsulated into separate
classes to be more reusable. The password edit and generator widgets
have also been refactored to be more reusable.
This commit is contained in:
Janek Bevendorff 2018-05-13 23:21:43 +02:00
parent e4ded388b4
commit e443cde452
116 changed files with 5054 additions and 1692 deletions

View file

@ -40,8 +40,8 @@ void TestKeePass2Format::initTestCase()
QVERIFY(m_xmlDb.data());
// construct and write KDBX to buffer
CompositeKey key;
key.addKey(PasswordKey("test"));
auto key = QSharedPointer<CompositeKey>::create();
key->addKey(QSharedPointer<PasswordKey>::create("test"));
m_kdbxSourceDb.reset(new Database());
m_kdbxSourceDb->setKey(key);
@ -495,8 +495,8 @@ void TestKeePass2Format::testXmlRepairUuidHistoryItem()
void TestKeePass2Format::testReadBackTargetDb()
{
// read back previously constructed KDBX
CompositeKey key;
key.addKey(PasswordKey("test"));
auto key = QSharedPointer<CompositeKey>::create();
key->addKey(QSharedPointer<PasswordKey>::create("test"));
bool hasError;
QString errorString;
@ -542,8 +542,8 @@ void TestKeePass2Format::testKdbxNonAsciiPasswords()
void TestKeePass2Format::testKdbxDeviceFailure()
{
CompositeKey key;
key.addKey(PasswordKey("test"));
auto key = QSharedPointer<CompositeKey>::create();
key->addKey(QSharedPointer<PasswordKey>::create("test"));
QScopedPointer<Database> db(new Database());
db->setKey(key);
// Disable compression so we write a predictable number of bytes.
@ -569,7 +569,7 @@ void TestKeePass2Format::testKdbxDeviceFailure()
void TestKeePass2Format::testDuplicateAttachments()
{
QScopedPointer<Database> db(new Database());
db->setKey(CompositeKey());
db->setKey(QSharedPointer<CompositeKey>::create());
const QByteArray attachment1("abc");
const QByteArray attachment2("def");
@ -612,7 +612,7 @@ void TestKeePass2Format::testDuplicateAttachments()
}
buffer.seek(0);
readKdbx(&buffer, CompositeKey(), db, hasError, errorString);
readKdbx(&buffer, QSharedPointer<CompositeKey>::create(), db, hasError, errorString);
if (hasError) {
QFAIL(qPrintable(QString("Error while reading database: %1").arg(errorString)));
}