Skip to content

Commit

Permalink
Enigma: Fix finding of a private key when decrypting a message using …
Browse files Browse the repository at this point in the history
…GnuPG v2.3

Additional fix for a case when sender's public key is in the keyring
  • Loading branch information
alecpl committed Nov 22, 2023
1 parent 1bd6a00 commit f654359
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/enigma/lib/enigma_ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ function password_prompt($status, $params = [])
// A message can be encrypted with multiple private keys,
// find the one that exists in the keyring
foreach ($data as $keyid => $username) {
if ($key = $this->enigma->engine->get_key($keyid)) {
$key = $this->enigma->engine->get_key($keyid);
if ($key && $key->is_private()) {
if ($key->name && strpos($username, $keyid) !== false) {
$data[$keyid] = $key->name;
}
Expand Down

0 comments on commit f654359

Please sign in to comment.