in reply to Need help decoding string in Crypt::OpenPGP

Do you run this cgi script using the same user as when you decrypting with gpg? What happens if you run it without cgi, something like this (not tested!):

use Crypt::OpenPGP; use File::Slurp; my $pgp = Crypt::OpenPGP->new(Compat => 'GnuPG'); my $phrase=read_file('file.txt'); my ($plaintext,$valid,$sig)=$pgp->decrypt( Data => $phrase, Passphrase => "abc123!", ); print "[message: $plaintext<br>valid: $valid<br>signature: $sig<br>err +or: ".$pgp->errstr."]<br><br>\n";

Replies are listed 'Best First'.
Re^2: Can't decode string in Crypt::OpenPGP
by jaf0faj (Novice) on Mar 11, 2012 at 14:30 UTC

    Unfortunately, no difference. Copied your code verbatim into the file 'decodetest', replaced instances of '<br>' with '\n' in the print statement, then ran "perl decodetest". Same results:
    message:
    valid:
    signature:
    error: Symkey decrypt failed: Invalid secret key ID