diff --git a/t/19-issue-79798.t b/t/19-issue-79798.t new file mode 100644 index 0000000..0522f7c --- /dev/null +++ b/t/19-issue-79798.t @@ -0,0 +1,53 @@ +use strict; +use warnings; + +use Test::More tests => 2; + +use Crypt::OpenPGP; + +use vars qw( $SAMPLES ); +unshift @INC, 't/'; +require 'test-common.pl'; +use File::Spec; + +my $encrypted = <<'ENCRYPTED'; +-----BEGIN PGP MESSAGE----- +Version: GnuPG v1 + +hQIOA5M412pWe59CEAf/eygcKcs9i27HSgewRpg9PSuaPSCXE3/O8+Kn+yaJtc1N +NAftT6S/QbqxuMmeAR1jSil1lZuCq5znldQKbmsBzvNe5B92OK0ruVtPBSnfV87x +Dpfh+lf/IGWBRZOcxGi6mErfVgQYJddeKwSR3M8q8NQaXqeOABK8D/sR3ku8C5u0 +y3+quHUterlguJVy8UgrZic2e2ocWX/RK1iHChhOhAGjcSMI/n3qPH8xhCSRuPmi +9uq0tenaktvrd0FpBamUbM4Sqdh9Dn8jByWgYPue+W4HgtJTxweu+2iZ7sRGtYcb +wowmTexuVoZisnY73X1Jzy5zA/z8ANjgY1ObgkX0cAgAjGMOCyCVW/qcBCdI9b6p +D7hYuqWuILMlAfLbj13BBxFYUA9zRLlpVdKbetWe/HEzNDYewt4ORM3sIrh78NPo +1qcS6RXnBv3ipg+oZXCy+ePJkUyoECsEJfiM+YiySwgOLGDyk1MlK1Be8c+LQAa4 +/9jWixK7gmRBda+KYOE7xTpKMUdUXuKWxDR0g861hoquizi3fjNVayvrjgSbEvi7 +jr4O/EBQvE0Ebniryo9x5S1y9voVqsVaalswZT+G1TVflFLD2YYXvGQPDLXKHfIq +BRsroH1tVmRDj6/qF5RR4Yg6Y1y0kHrUlIW0Qt/koSv8loAhLxYWb7Dt71+i62WQ +6dJTAbMm7W7hI3Ikc/0LMOEUTHneuLMK9VHfVpbRkUzxUthaAphGulPL/m65GK8s +OSP07ZS5UVwk1aghrdVDXBORIYyubECxxcZK86H+wmf6Rp+bkUw= +=XsZR +-----END PGP MESSAGE----- +ENCRYPTED + +my $original = << 'ORIGINAL'; +Encrypt with RSA SubKey +ORIGINAL +my $secring = File::Spec->catfile( $SAMPLES, 'gpg', 'subkeys-ring.sec' ); +my $pubring = File::Spec->catfile( $SAMPLES, 'gpg', 'subkeys-ring.pub' ); +my $passphrase = 'foobar'; + +my $pgp = Crypt::OpenPGP->new( + SecRing => $secring, + PubRing => $pubring, + ); +ok($pgp, "Crypt::OpenPGP created"); + +my $plaintext = $pgp->decrypt( + Data => $encrypted, + Passphrase => $passphrase, + ); +like($plaintext, qr/$original/, "Crypt::OpenPGP can verify signature"); + +done_testing; diff --git a/t/samples/gpg/subkeys-ring.pub b/t/samples/gpg/subkeys-ring.pub new file mode 100644 index 0000000..5880dc6 Binary files /dev/null and b/t/samples/gpg/subkeys-ring.pub differ diff --git a/t/samples/gpg/subkeys-ring.sec b/t/samples/gpg/subkeys-ring.sec new file mode 100644 index 0000000..231768b Binary files /dev/null and b/t/samples/gpg/subkeys-ring.sec differ