From e00059d0c44c996bff10845c875151a2169d0d47 Mon Sep 17 00:00:00 2001
From: Alexandre Petit <62973006+AlexpFr@users.noreply.github.com>
Date: Sun, 28 Apr 2024 13:22:08 +0200
Subject: [PATCH] SSH Agent: Fix broken decrypt button (#10637)
---
share/translations/keepassxc_en.ts | 4 ++++
src/gui/entry/EditEntryWidget.cpp | 8 ++++----
src/sshagent/KeeAgentSettings.cpp | 4 ++--
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/share/translations/keepassxc_en.ts b/share/translations/keepassxc_en.ts
index 126deb41b0..bff4663360 100644
--- a/share/translations/keepassxc_en.ts
+++ b/share/translations/keepassxc_en.ts
@@ -2669,6 +2669,10 @@ Would you like to correct it?
+
+
+
+
EditEntryWidgetAdvanced
diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp
index 6620b08077..bdcbfe6c73 100644
--- a/src/gui/entry/EditEntryWidget.cpp
+++ b/src/gui/entry/EditEntryWidget.cpp
@@ -665,18 +665,18 @@ void EditEntryWidget::updateSSHAgentKeyInfo()
m_sshAgentUi->fingerprintTextLabel->setText(tr("(encrypted)"));
}
- if (!key.comment().isEmpty() || !key.encrypted()) {
+ if (!key.comment().isEmpty()) {
m_sshAgentUi->commentTextLabel->setText(key.comment());
- } else {
+ } else if (key.encrypted()) {
m_sshAgentUi->commentTextLabel->setText(tr("(encrypted)"));
m_sshAgentUi->decryptButton->setEnabled(true);
}
- if (!key.publicKey().isEmpty()) {
+ if (!key.publicKey().isEmpty() && !key.encrypted()) {
m_sshAgentUi->publicKeyEdit->document()->setPlainText(key.publicKey());
m_sshAgentUi->copyToClipboardButton->setEnabled(true);
} else {
- m_sshAgentUi->publicKeyEdit->document()->setPlainText(tr("(encrypted)"));
+ m_sshAgentUi->publicKeyEdit->document()->setPlainText(key.publicKey() + tr("(comment is encrypted)"));
m_sshAgentUi->copyToClipboardButton->setDisabled(true);
}
diff --git a/src/sshagent/KeeAgentSettings.cpp b/src/sshagent/KeeAgentSettings.cpp
index 272fb7edf7..8393391525 100644
--- a/src/sshagent/KeeAgentSettings.cpp
+++ b/src/sshagent/KeeAgentSettings.cpp
@@ -489,11 +489,11 @@ bool KeeAgentSettings::toOpenSSHKey(const QString& username,
}
}
- if (key.comment().isEmpty()) {
+ if (key.comment().isEmpty() && !key.encrypted()) {
key.setComment(username);
}
- if (key.comment().isEmpty()) {
+ if (key.comment().isEmpty() && !key.encrypted()) {
key.setComment(fileName);
}