mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-01 19:16:16 -04:00
Add support for version 2 XML key files.
As discussed in #4317, the next KeePass2 release will ship with support for a new generation of XML key files which enable hash integrity checks. This patch adds support for reading and generating this new format. By default, KeePass2 now uses the .keyx extension for generated key files, which was added to KeePassXC's key generation file chooser filter. We continue to generate hashed binary key files by default, but the user can explicitly save the file with the new .keyx extension to generate an XML v2 key file (currently undocumented). When opening a database, the key file type is still determined by content negotation, so the file extension has no impact here. As an additional change, the legacy key file warnings have been improved slightly to be less confusing and more helpful.
This commit is contained in:
parent
404fd941e8
commit
cd0084f21c
12 changed files with 233 additions and 118 deletions
|
@ -47,12 +47,12 @@ bool KeyFileEditWidget::addToCompositeKey(QSharedPointer<CompositeKey> key)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (fileKey->type() != FileKey::Hashed) {
|
||||
if (fileKey->type() != FileKey::KeePass2XMLv2 && fileKey->type() != FileKey::Hashed) {
|
||||
QMessageBox::warning(getMainWindow(),
|
||||
tr("Legacy key file format"),
|
||||
tr("You are using a legacy key file format which may become\n"
|
||||
"unsupported in the future.\n\n"
|
||||
"Generate a new key file in the database security settings."),
|
||||
tr("Old key file format"),
|
||||
tr("You selected a key file in an old format which KeePassXC<br>"
|
||||
"may stop supporting in the future.<br><br>"
|
||||
"Please consider generating a new key file instead."),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ void KeyFileEditWidget::createKeyFile()
|
|||
if (!m_compEditWidget) {
|
||||
return;
|
||||
}
|
||||
QString filters = QString("%1 (*.key);;%2 (*)").arg(tr("Key files"), tr("All files"));
|
||||
QString filters = QString("%1 (*.keyx; *.key);;%2 (*)").arg(tr("Key files"), tr("All files"));
|
||||
QString fileName = fileDialog()->getSaveFileName(this, tr("Create Key File..."), QString(), filters);
|
||||
|
||||
if (!fileName.isEmpty()) {
|
||||
|
@ -119,7 +119,7 @@ void KeyFileEditWidget::browseKeyFile()
|
|||
if (!m_compEditWidget) {
|
||||
return;
|
||||
}
|
||||
QString filters = QString("%1 (*.key);;%2 (*)").arg(tr("Key files"), tr("All files"));
|
||||
QString filters = QString("%1 (*.keyx; *.key);;%2 (*)").arg(tr("Key files"), tr("All files"));
|
||||
QString fileName = fileDialog()->getOpenFileName(this, tr("Select a key file"), QString(), filters);
|
||||
|
||||
if (QFileInfo(fileName).canonicalFilePath() == m_parent->getDatabase()->canonicalFilePath()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue