diff --git a/src/JWT.php b/src/JWT.php index 93f6e47d..e9d75639 100644 --- a/src/JWT.php +++ b/src/JWT.php @@ -251,7 +251,7 @@ public static function sign( return \hash_hmac($algorithm, $msg, $key, true); case 'openssl': $signature = ''; - if (!openssl_pkey_get_private($key)) { + if (!\is_resource($key) && !openssl_pkey_get_private($key)) { throw new DomainException('OpenSSL unable to validate key'); } $success = \openssl_sign($msg, $signature, $key, $algorithm); // @phpstan-ignore-line