Skip to content

Commit

Permalink
solves error (Symkey decrypt failed: Invalid secret key ID)
Browse files Browse the repository at this point in the history
"Symkey decrypt failed: Invalid secret key ID" problem in https://stackoverflow.com/questions/12540226/cryptopenpgp-symkey-decrypt-failed-invalid-secret-key-id .
I use openpgp.js for the encryption of messages and get the same error. It seems openpgp.js uses the subkey for encryption of the sessionkey. So I suggest "$kb->key_by_id($sym_key->key_id)" instead of "$kb->encrypting_key".
  • Loading branch information
pinmarch authored and timlegge committed Oct 14, 2024
1 parent 68371b4 commit 0bf6750
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Crypt/OpenPGP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ sub decrypt {
return $pgp->error("Can't find a secret key to decrypt message")
unless $kb || $cert;
if ($kb) {
$cert = $kb->encrypting_key;
$cert = $kb->key_by_id($sym_key->key_id);
$cert->uid($kb->primary_uid);
}
if ($cert->is_protected) {
Expand Down

0 comments on commit 0bf6750

Please sign in to comment.