mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-05-29 11:32:03 -04:00
SSH Agent: Fix handling of encrypted RSA keys
Also fix multiple UI issues caused by said keys. Fixes #1560
This commit is contained in:
parent
97a890e8a0
commit
b0a61f437a
4 changed files with 52 additions and 26 deletions
|
@ -94,6 +94,10 @@ int OpenSSHKey::keyLength() const
|
|||
|
||||
const QString OpenSSHKey::fingerprint() const
|
||||
{
|
||||
if (m_publicData.isEmpty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
QByteArray publicKey;
|
||||
BinaryStream stream(&publicKey);
|
||||
|
||||
|
@ -115,6 +119,10 @@ const QString OpenSSHKey::comment() const
|
|||
|
||||
const QString OpenSSHKey::publicKey() const
|
||||
{
|
||||
if (m_publicData.isEmpty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
QByteArray publicKey;
|
||||
BinaryStream stream(&publicKey);
|
||||
|
||||
|
@ -326,7 +334,7 @@ bool OpenSSHKey::openPrivateKey(const QString& passphrase)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (passphrase.length() == 0) {
|
||||
if (passphrase.isEmpty()) {
|
||||
m_error = tr("Passphrase is required to decrypt this key");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -260,6 +260,10 @@ void SSHAgent::databaseModeChanged(DatabaseWidget::Mode mode)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!key.openPrivateKey(e->password())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (key.comment().isEmpty()) {
|
||||
key.setComment(e->username());
|
||||
}
|
||||
|
@ -268,7 +272,7 @@ void SSHAgent::databaseModeChanged(DatabaseWidget::Mode mode)
|
|||
removeIdentityAtLock(key, uuid);
|
||||
}
|
||||
|
||||
if (settings.addAtDatabaseOpen() && key.openPrivateKey(e->password())) {
|
||||
if (settings.addAtDatabaseOpen()) {
|
||||
int lifetime = 0;
|
||||
|
||||
if (settings.useLifetimeConstraintWhenAdding()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue