diff --git a/src/Signer/Rsa.php b/src/Signer/Rsa.php index a89ff456..0db19c57 100644 --- a/src/Signer/Rsa.php +++ b/src/Signer/Rsa.php @@ -26,7 +26,12 @@ public function createHash($payload, Key $key) $this->validateKey($key); $signature = ''; - openssl_sign($payload, $signature, $key, $this->getAlgorithm()); + + if (!openssl_sign($payload, $signature, $key, $this->getAlgorithm())) { + throw new InvalidArgumentException( + 'There was an error while creating the signature: ' . openssl_error_string() + ); + } return $signature; } @@ -47,8 +52,6 @@ public function doVerify($expected, $payload, Key $key) * * @param resource $key * - * @return boolean - * * @throws InvalidArgumentException */ private function validateKey($key)