This commit is contained in:
the-djmaze 2023-09-11 21:44:57 +02:00
parent c60f8776f4
commit 49010a70a0

View file

@ -299,13 +299,13 @@ class GnuPG
'private' => []
];
// Public
foreach ($this->handler()->keyinfo($pattern) as $key) {
foreach (($this->handler()->keyinfo($pattern) ?: []) as $key) {
$key['can_verify'] = $key['can_sign'];
unset($key['can_sign']);
$keys['public'][] = $key;
}
// Private, read https://github.com/php-gnupg/php-gnupg/issues/5
foreach ($this->handler()->keyinfo($pattern, 1) as $key) {
foreach (($this->handler()->keyinfo($pattern, 1) ?: []) as $key) {
$key['can_decrypt'] = $key['can_encrypt'];
unset($key['can_encrypt']);
$keys['private'][] = $key;