diff --git a/share/translations/keepassxc_en.ts b/share/translations/keepassxc_en.ts
index b23d7b082..0861369e5 100644
--- a/share/translations/keepassxc_en.ts
+++ b/share/translations/keepassxc_en.ts
@@ -2607,10 +2607,6 @@ Disable safe saves and try again?
n/a
-
- (encrypted)
-
-
Select private key
@@ -2720,6 +2716,10 @@ Would you like to correct it?
+
+ Failed to decrypt SSH key, ensure password is correct.
+
+
EditEntryWidgetAdvanced
@@ -6091,6 +6091,10 @@ We recommend you use the AppImage available on our downloads page.
Unexpected EOF when writing private key
+
+ (encrypted)
+
+
AES-256/GCM is currently not supported
diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp
index 2b6960753..e00b09432 100644
--- a/src/gui/entry/EditEntryWidget.cpp
+++ b/src/gui/entry/EditEntryWidget.cpp
@@ -654,23 +654,17 @@ 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)"));
- m_sshAgentUi->decryptButton->setEnabled(true);
}
+ m_sshAgentUi->decryptButton->setEnabled(key.encrypted());
+
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
@@ -784,6 +778,7 @@ void EditEntryWidget::decryptPrivateKey()
OpenSSHKey key;
if (!getOpenSSHKey(key, true)) {
+ showMessage(tr("Failed to decrypt SSH key, ensure password is correct."), MessageWidget::Error);
return;
}
@@ -797,6 +792,7 @@ void EditEntryWidget::decryptPrivateKey()
+ key.fingerprint(QCryptographicHash::Sha256));
m_sshAgentUi->publicKeyEdit->document()->setPlainText(key.publicKey());
m_sshAgentUi->copyToClipboardButton->setEnabled(true);
+ m_sshAgentUi->decryptButton->setEnabled(false);
}
void EditEntryWidget::copyPublicKey()
diff --git a/src/sshagent/KeeAgentSettings.cpp b/src/sshagent/KeeAgentSettings.cpp
index 272fb7edf..a794eac93 100644
--- a/src/sshagent/KeeAgentSettings.cpp
+++ b/src/sshagent/KeeAgentSettings.cpp
@@ -490,11 +490,7 @@ bool KeeAgentSettings::toOpenSSHKey(const QString& username,
}
if (key.comment().isEmpty()) {
- key.setComment(username);
- }
-
- if (key.comment().isEmpty()) {
- key.setComment(fileName);
+ key.setComment(QString("%1@%2").arg(username, fileName));
}
return true;
diff --git a/src/sshagent/OpenSSHKey.cpp b/src/sshagent/OpenSSHKey.cpp
index e6b21c863..dcc518a86 100644
--- a/src/sshagent/OpenSSHKey.cpp
+++ b/src/sshagent/OpenSSHKey.cpp
@@ -81,7 +81,7 @@ const QString OpenSSHKey::type() const
const QString OpenSSHKey::fingerprint(QCryptographicHash::Algorithm algo) const
{
if (m_rawPublicData.isEmpty()) {
- return {};
+ return tr("(encrypted)");
}
QByteArray publicKey;
@@ -285,6 +285,8 @@ bool OpenSSHKey::parsePKCS1PEM(const QByteArray& in)
// load private if no encryption
if (!encrypted()) {
return openKey();
+ } else {
+ m_comment = tr("(encrypted)");
}
return true;