Skip to content

Commit

Permalink
updated phpseclib3
Browse files Browse the repository at this point in the history
  • Loading branch information
Hergen Dillema committed Sep 10, 2021
1 parent aec96c0 commit e9abf55
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "werk365/jwtauthroles",
"description": "Made to use fusionauth users in Laravel using JWT. Possible to either use pem keys directly or use the jwks endpoint.",
"version": "1.2.0",
"version": "1.2.1",
"license": "MIT",
"authors": [
{
Expand Down
15 changes: 4 additions & 11 deletions src/JwtAuthRoles.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use Firebase\JWT\JWT;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Str;
use phpseclib\Crypt\RSA;
use phpseclib\Math\BigInteger;
use phpseclib3\Crypt\PublicKeyLoader;
use phpseclib3\Math\BigInteger;
use Werk365\JwtAuthRoles\Exceptions\AuthException;
use Werk365\JwtAuthRoles\Models\JwtKey;
use Werk365\JwtAuthRoles\Models\JwtUser;
Expand Down Expand Up @@ -46,17 +46,10 @@ private static function jwkToPem(object $jwk): ?string
throw AuthException::auth(500, 'Malformed jwk');
}

$rsa = new RSA();
$rsa->loadKey([
return PublicKeyLoader::load([
'e' => new BigInteger(JWT::urlsafeB64Decode($jwk->e), 256),
'n' => new BigInteger(JWT::urlsafeB64Decode($jwk->n), 256),
]);

if ($rsa->getPublicKey() === false) {
return null;
}

return $rsa->getPublicKey();
])->withHash('sha1');
}

private static function getJwk(string $kid, string $uri): ?string
Expand Down

0 comments on commit e9abf55

Please sign in to comment.