Skip to content

Commit

Permalink
fix: skip valid private key check on resource type
Browse files Browse the repository at this point in the history
  • Loading branch information
vishwarajanand committed Mar 15, 2024
1 parent fb53943 commit 7ff2941
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/JWT.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7ff2941

Please sign in to comment.