Here is an SSCCE showing an encryption/decryption round trip. Just set the three env vars accordingly and run.
#!/usr/bin/env perl use strict; use warnings; use feature 'say'; use Crypt::GPG; my $gpg = Crypt::GPG->new; $gpg->gpgbin ('/usr/bin/gpg'); $gpg->secretkey ($ENV{SECRET_KEY}); $gpg->passphrase ($ENV{GPG_PP}); $gpg->armor (1); my $plaintext = 'PerlMonks Rocks!'; say "Plain text: $plaintext"; my @enctext = $gpg->encrypt ([$plaintext], $ENV{TO_EMAIL}); say "Encrypted text: @enctext"; my $decrypted = $gpg->verify (\@enctext); say "Decrypted text: $decrypted";
🦛
In reply to Re^5: Unable to get any decrypted output from $gpg->verify
by hippo
in thread Unable to get any decrypted output from $gpg->verify
by xuo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |