Fix #32: Decryption of message encrypted with multiple keys (#55)

When the message is encrypted with multiple keys and the decryption
key(s) added is not the first encrypted key, then it was failing due to
invalid early failure when uid was not found in decrypted keys. This
changes such behavior and just returns empty key instead in such case.
This commit is contained in:
Jakub Zelenka 2025-05-20 17:23:58 +01:00 committed by GitHub
parent 91e92a2690
commit 74993ff4a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 137 additions and 4 deletions

View file

@ -66,7 +66,7 @@ class gnupgt {
}
/**
* Import all keys
* Import a single key
*/
static public function import_key($privkey = null)
{
@ -78,6 +78,21 @@ class gnupgt {
$gpg->import(is_null($privkey) ? $testkey : $privkey);
}
/**
* Import all keys
*/
static public function import_keys()
{
global $testkey, $testkey2, $testkey3;
self::reset_key();
$gpg = self::create_instance();
$gpg->import($testkey);
$gpg->import($testkey2);
$gpg->import($testkey3);
}
/**
* Delete all keys.
* @param null|string $homeDir