From d4f07dfeb0f5ca41eefe8123c850c81727d6dc9f 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 | 8 ++++----
src/gui/entry/EditEntryWidget.cpp | 12 ++++--------
src/sshagent/OpenSSHKey.cpp | 4 +++-
3 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/share/translations/keepassxc_en.ts b/share/translations/keepassxc_en.ts
index 1be7981056..2b55841e12 100644
--- a/share/translations/keepassxc_en.ts
+++ b/share/translations/keepassxc_en.ts
@@ -2556,10 +2556,6 @@ Disable safe saves and try again?
-
-
-
-
@@ -6232,6 +6228,10 @@ We recommend you use the AppImage available on our downloads page.
+
+
+
+
diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp
index 0523026f7c..7aee16b832 100644
--- a/src/gui/entry/EditEntryWidget.cpp
+++ b/src/gui/entry/EditEntryWidget.cpp
@@ -721,23 +721,19 @@ void EditEntryWidget::updateSSHAgentKeyInfo()
if (!key.fingerprint().isEmpty()) {
m_sshAgentUi->fingerprintTextLabel->setText(key.fingerprint(QCryptographicHash::Md5) + "\n"
+ key.fingerprint(QCryptographicHash::Sha256));
- } else {
- m_sshAgentUi->fingerprintTextLabel->setText(tr("(encrypted)"));
}
- if (!key.comment().isEmpty() || !key.encrypted()) {
+ if (!key.comment().isEmpty()) {
m_sshAgentUi->commentTextLabel->setText(key.comment());
- } else {
- m_sshAgentUi->commentTextLabel->setText(tr("(encrypted)"));
+ }
+
+ if (key.encrypted()) {
m_sshAgentUi->decryptButton->setEnabled(true);
}
if (!key.publicKey().isEmpty()) {
m_sshAgentUi->publicKeyEdit->document()->setPlainText(key.publicKey());
m_sshAgentUi->copyToClipboardButton->setEnabled(true);
- } else {
- m_sshAgentUi->publicKeyEdit->document()->setPlainText(tr("(encrypted)"));
- m_sshAgentUi->copyToClipboardButton->setDisabled(true);
}
// enable agent buttons only if we have an agent running
diff --git a/src/sshagent/OpenSSHKey.cpp b/src/sshagent/OpenSSHKey.cpp
index 8db2d5852f..40d95a5171 100644
--- a/src/sshagent/OpenSSHKey.cpp
+++ b/src/sshagent/OpenSSHKey.cpp
@@ -93,7 +93,7 @@ const QString OpenSSHKey::certificateType() const
const QString OpenSSHKey::fingerprint(QCryptographicHash::Algorithm algo) const
{
if (m_rawPublicData.isEmpty()) {
- return {};
+ return {tr("(encrypted)")};
}
QByteArray publicKey;
@@ -360,6 +360,8 @@ bool OpenSSHKey::parsePKCS1PEM(const QByteArray& in)
// load private if no encryption
if (!encrypted()) {
return openKey();
+ } else {
+ m_comment = tr("(encrypted)");
}
return true;