mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-03-12 17:16:43 -04:00
Fix SSH Agent broken decrypt button (#10638)
* SSH Agent: Fix broken decrypt button (Fixes #10637) --------- Co-authored-by: Jonathan White <support@dmapps.us>
This commit is contained in:
parent
1bdf1bbbed
commit
1b3abf8ab0
@ -2607,10 +2607,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>
|
||||
@ -2720,6 +2716,10 @@ Would you like to correct it?</source>
|
||||
<numerusform></numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to decrypt SSH key, ensure password is correct.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditEntryWidgetAdvanced</name>
|
||||
@ -6091,6 +6091,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>AES-256/GCM is currently not supported</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -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()
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user