Skip to content

Commit

Permalink
SSH Agent: Fix broken decrypt button (keepassxreboot#10637)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexpFr committed Apr 28, 2024
1 parent a542ded commit 3da116d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions share/translations/keepassxc_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2653,6 +2653,10 @@ Would you like to correct it?</source>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>(comment is encrypted)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditEntryWidgetAdvanced</name>
Expand Down
8 changes: 4 additions & 4 deletions src/gui/entry/EditEntryWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions src/sshagent/KeeAgentSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 3da116d

Please sign in to comment.