We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5c648ae commit f654155Copy full SHA for f654155
src/ValidatesJWT.php
@@ -95,12 +95,12 @@ protected function validateTimestamps(array $payload)
95
*/
96
protected function validateKey()
97
{
98
- if (\is_string($this->key)) {
99
- if (!\is_file($this->key)) {
100
- throw new JWTException('Invalid key: Should be file path of private key', static::ERROR_KEY_INVALID);
+ if (\is_string($key = $this->key)) {
+ if (\substr($key, 0, 7) !== 'file://') {
+ $key = 'file://' . $key;
101
}
102
103
- $this->key = \openssl_get_privatekey('file://' . $this->key, $this->passphrase ?? '');
+ $this->key = \openssl_get_privatekey($key, $this->passphrase ?? '');
104
105
106
if (!\is_resource($this->key)) {
0 commit comments