diff --git a/src/JWT.php b/src/JWT.php index ff7c07d4..9a98cb00 100644 --- a/src/JWT.php +++ b/src/JWT.php @@ -208,9 +208,11 @@ private static function verify($msg, $signature, $key, $alg) list($function, $algorithm) = self::$supported_algs[$alg]; switch($function) { case 'openssl': + while ($err = openssl_error_string()) {} $success = openssl_verify($msg, $signature, $key, $algorithm); + while ($err = openssl_error_string()) {$errors[] = $err;} if (!$success) { - throw new DomainException("OpenSSL unable to verify data: " . openssl_error_string()); + throw new DomainException("OpenSSL unable to verify data: " . implode(',', $errors)); } else { return $signature; }