Version, target platform, OS
<=10.0.1
Description
**Incorrect Curve Handling in ECDSA **
We discovered that your library permits public keys generated over the P-256 curve to be used for signature generation, even when the JWT header explicitly specifies "alg": "ES512". This is a standards violation and introduces a dangerous algorithm downgrade scenario.
According to RFC 7518, Section 3.4, ES512 must use the P-521 curve. Allowing weaker curves can be exploited to mount signature confusion or cryptographic downgrade attacks.
How to reproduce
Curve parameter validation to ensure alignment with the declared JWT algorithm.
Rejecting any JWTs where the key type or curve does not strictly match the alg header.
Additional context
An example token using P-256 curve key and 'alg' parameter is ES512
