Skip to content

Commit

Permalink
Merge pull request #6 from perlDreamer/master
Browse files Browse the repository at this point in the history
Fixes for issue #5, and object serialization within Ouch
  • Loading branch information
rizen committed Nov 20, 2019
2 parents e6752b3 + 569ce3e commit 2a2db21
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Changes
@@ -1,5 +1,9 @@
Revision history for Perl module AWS::SNS::Verify

0.0104 2019-05-01
* Fix issue #5
* Provide a way to serialize myself for Ouch messages

0.0104 2019-01-21
* Remove deps to Crypt::OpenSSL::RSA and Crypt::OpenSSL::X509 (Takumi Akiyama)

Expand Down
3 changes: 2 additions & 1 deletion dist.ini
Expand Up @@ -4,7 +4,7 @@ license = Perl_5
copyright_holder = Plain Black Coproration
copyright_year = 2015

version = 0.0104
version = 0.0105

[@Classic]

Expand All @@ -24,3 +24,4 @@ Moo = 0
Ouch = 0
CryptX = 0
URI::URL = 0
Data::Structure::Util = 0
7 changes: 6 additions & 1 deletion lib/AWS/SNS/Verify.pm
Expand Up @@ -9,6 +9,7 @@ use Moo;
use Ouch;
use Crypt::PK::RSA;
use URI::URL;
use Data::Structure::Util;

has body => (
is => 'ro',
Expand Down Expand Up @@ -89,7 +90,7 @@ sub verify {
my $self = shift;
my $pk = $self->certificate;
unless ($pk->verify_message($self->decode_signature, $self->generate_signature_string, 'SHA1', 'v1.5')) {
ouch 'Bad SNS Signature', 'Could not verify the SES message from its signature.', $self;
ouch 'Bad SNS Signature', 'Could not verify the SNS message from its signature.', $self;
}
return 1;
}
Expand Down Expand Up @@ -122,6 +123,10 @@ sub valid_cert_url {
return $url_string;
}

sub TO_JSON {
my $self = shift;
return unbless($self);
}

=head1 NAME
Expand Down
4 changes: 2 additions & 2 deletions t/01_verify.t
Expand Up @@ -98,8 +98,8 @@ END
my $tampered_body_sns = AWS::SNS::Verify->new(body => $tampered_body, certificate_string => $cert_string);
throws_ok(
sub { $tampered_body_sns->verify },
qr/Could not verify the SES message/,
"Tampered with body doesn't valiate",
qr/Could not verify the SNS message/,
"Tampered with body doesn't validate",
);


Expand Down

0 comments on commit 2a2db21

Please sign in to comment.