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 May 7, 2024
1 parent 8458b8c commit 99c964e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
8 changes: 4 additions & 4 deletions share/translations/keepassxc_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2556,10 +2556,6 @@ Disable safe saves and try again?</source>
<source>n/a</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>(encrypted)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select private key</source>
<translation type="unfinished"></translation>
Expand Down Expand Up @@ -6232,6 +6228,10 @@ We recommend you use the AppImage available on our downloads page.</source>
<source>Unexpected EOF when writing private key</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>(encrypted)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Invalid certificate file, expecting an OpenSSH certificate</source>
<translation type="unfinished"></translation>
Expand Down
12 changes: 4 additions & 8 deletions src/gui/entry/EditEntryWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/sshagent/OpenSSHKey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 99c964e

Please sign in to comment.