diff --git a/src/JWT.php b/src/JWT.php index 6d30e941..e1363ff1 100644 --- a/src/JWT.php +++ b/src/JWT.php @@ -224,9 +224,11 @@ private static function verify($msg, $signature, $key, $alg) list($function, $algorithm) = static::$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; }