Crypt::OpenPGP Symkey decrypt failed: Invalid secret key ID

[亡魂溺海] 提交于 2019-12-24 03:28:08

问题


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

  1. Encrypt with gpg and decrypt with gpg.
    • Works fine, as expected
  2. Encrypt with perl using Crypt::OpenPGP and decrypt with gpg.
    • Works fine.
  3. Encrypt with perl using Crypt::OpenPGP and decrypt with perl using Crypt::OpenPGP
    • Works fine.
  4. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!