Skip to content

Commit

Permalink
Merge pull request #23 from JorisvanW/patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore authored Feb 2, 2021
2 parents bc3b1eb + af06650 commit ffa9918
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ValidatesJWT.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ protected function validateKey()
$this->key = \openssl_get_privatekey($key, $this->passphrase ?: '');
}

if (!\is_resource($this->key)) {
if (\PHP_VERSION_ID < 80000 && !\is_resource($this->key)) {
throw new JWTException('Invalid key: Should be resource of private key', static::ERROR_KEY_INVALID);
}

if (\PHP_VERSION_ID > 80000 && !($this->key instanceof OpenSSLAsymmetricKey || $this->key instanceof OpenSSLCertificate || $this->key instanceof OpenSSLCertificateSigningRequest)) {
throw new JWTException('Invalid key: Should be resource of private key', static::ERROR_KEY_INVALID);
}
}
Expand Down

0 comments on commit ffa9918

Please sign in to comment.