forked from btrott/Crypt-OpenPGP
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for Fix for RT #79798 - Symkey decrypt failed: Invalid secre…
…t key ID
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
Binary file not shown.
Binary file not shown.