web-token / jwt-framework

JWT Framework
MIT License
888 stars 105 forks source link

Rsa signing works too slow #530

Closed CvekCoding closed 7 months ago

CvekCoding commented 7 months ago

Version(s) affected

3.3

Description

Hello. I ran into a problem when creating tokens - the RSA signature takes an insanely long time to work, a few minutes. At the same time, other algorithms (I checked ES256) work fast. The problem is in the \Jose\Component\Core function\Util\RSAKey::populateBigIntegers. Very heavy mathematical operations are launched there, which take up all the time.

I am attaching my project with vanilla Symfony and a generated 4096 RSA key. jwt-token.tar.gz

How to reproduce

  1. Launch docker-compose up -d
  2. docker compose exec php bin/console lexik:jwt:generate-token test

The project also contains es-signature, and it works blazing fast.

Possible Solution

No response

Additional Context

No response

Spomky commented 7 months ago

Hi,

Have you installed GMP or BCMATH extension? https://github.com/web-token/jwt-framework/blob/3e87ce132f6cbeb228b6d4d9ad105dce395458d8/src/Library/composer.json#L57

CvekCoding commented 7 months ago

Let me try...

CvekCoding commented 7 months ago

You are right, now it works. I was sure that I had looked through all the hints in composer(

CvekCoding commented 7 months ago

Thanks for fast response

github-actions[bot] commented 6 months ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.