问题
I am having a problem where Crypt::OpenPGP is unable to decrypt a message encoded by GPG. It seems that I am not the first to have this problem. But no solution was found on that thread.
my $pgp = load_class('Crypt::OpenPGP')->new;
$pgp->handle(
Data => $encrypted,
) or confess $pgp->errstr;
Crypt::OpenPGP prompts correctly for the key passphrase, finding the key successfully, and I'v tested to make sure the passphrase works with GPG. But when attempting to decrypt the message with Crypt::OpenPGP I get the error.
Symkey decrypt failed: Invalid secret key ID
according to the thread the following have been tested
- Encrypt with gpg and decrypt with gpg.
- Works fine, as expected
- Encrypt with perl using Crypt::OpenPGP and decrypt with gpg.
- Works fine.
- Encrypt with perl using Crypt::OpenPGP and decrypt with perl using Crypt::OpenPGP
- Works fine.
- Encrypt with gpg and decrypt with perl using Crypt::OpenPGP
- Failure with "Symkey decrypt failed: Invalid secret key ID" message. This is the situation described above
which seems to reflect my own observation though I've not tested a few of these. Does anyone know the cause or even better a fix?
来源:https://stackoverflow.com/questions/12540226/cryptopenpgp-symkey-decrypt-failed-invalid-secret-key-id