File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,11 @@ public function validate(Message $message)
8686 // Get the certificate.
8787 $ this ->validateUrl ($ message ['SigningCertURL ' ]);
8888 $ certificate = call_user_func ($ this ->certClient , $ message ['SigningCertURL ' ]);
89+ if ($ certificate === false ) {
90+ throw new InvalidSnsMessageException (
91+ "Cannot get the certificate from \"{$ message ['SigningCertURL ' ]}\". "
92+ );
93+ }
8994
9095 // Extract the public key.
9196 $ key = openssl_get_publickey ($ certificate );
Original file line number Diff line number Diff line change @@ -88,6 +88,17 @@ function () {
8888 $ this ->assertTrue ($ validator ->isValid ($ message ));
8989 }
9090
91+ /**
92+ * @expectedException \Aws\Sns\Exception\InvalidSnsMessageException
93+ * @expectedExceptionMessageRegExp /Cannot get the certificate from ".+"./
94+ */
95+ public function testValidateFailsWhenCannotGetCertificate ()
96+ {
97+ $ validator = new MessageValidator ($ this ->getMockHttpClient (false ));
98+ $ message = $ this ->getTestMessage ();
99+ $ validator ->validate ($ message );
100+ }
101+
91102 /**
92103 * @expectedException \Aws\Sns\Exception\InvalidSnsMessageException
93104 * @expectedExceptionMessage Cannot get the public key from the certificate.
You can’t perform that action at this time.
0 commit comments