web-token/jwt-signature-algorithm-rsa
RSA-based signature algorithms for JWT using the web-token/JWT stack. Provides RSA sign/verify support (e.g., RS256/RS384/RS512) to add strong asymmetric cryptography to token creation and validation workflows.
RS256, RS384, RS512). It is not for signing tokens (only verification).
firebase/php-jwt or web-token/jwt-framework).firebase/php-jwt (via tymon/jwt-auth) supports RSA validation, but this package could be a lightweight alternative if you need explicit RSA-only validation without bloating dependencies.web-token/jwt-framework or similar).AuthServiceProvider or a custom JWTGuard).Auth or Sanctum systems.tymon/jwt-auth).tymon/jwt-auth or firebase/php-jwt if validation is delegated to this package.AuthServiceProvider, middleware).use WebToken\JWT\Signature\Algorithm\RSA\RS256;
$validator = new RS256();
$isValid = $validator->validate($token, $publicKey);
public function handle($request, Closure $next) {
$token = $request->bearerToken();
$publicKey = config('jwt.rsa_public_key');
$validator = new RS256();
if (!$validator->validate($token, $publicKey)) {
abort(401, 'Invalid JWT signature');
}
return $next($request);
}
composer.json).RS256, RS384, RS512 (confirm via package docs).RS384) if needed.firebase/php-jwt or tymon/jwt-auth as a backup if issues arise.RS512). Benchmark under load.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Invalid RSA key configuration | All RSA JWT validations fail | Use environment variables for keys |
| PHP OpenSSL misconfiguration | Silent validation failures | Test with known-good keys |
| Package abandonment | No security updates | Fork or switch to firebase/php-jwt |
| Algorithm mismatch (e.g., RS256 vs. HS256) | False rejections | Document supported algorithms explicitly |
How can I help you explore Laravel packages today?