-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong ES256 signature length #187
Comments
Seems like the JOSEToDER is incorrect. Below is a JWT signature produced by other library. The method adds redundant zero byte to make the signature S component positive, while its already positive. 30 46 02 21 00b08c3280fc20fd95351aa081526e6a846781ef68b2cee8a71866d500c0286f72 02 21 0017457be7263fa2f3e34294d2f323f3168b6788d3d403f784d1a83b722ad25add 0x30; TotalLen=70(0x46); 0x02; ECRLen=33(0x21) - properly padded; 0x02; ECSLen=33(0x21); The padding is wrong as 0x17 is positive; |
Just got bit by this too. Completely broken. Needs DERToJOSE. |
I'll look into it this week. Thanks for reporting this. |
@coelho @ivailokolev I've submitted #212 with the fix. Please, give it a try and leave any feedback here or in the PR discussion. |
@lbalmaceda looks good thanks! |
@lbalmaceda Thank you. Crossed checked with another JWT library, both sign and verify were OK. If I may suggest a little change in the dependencies - bump up the Jakson's Databind to 2.9.2. |
Hi @lbalmaceda |
I'll try to make a release today. 👍 |
version |
Hi,
Seems like the ES256 signature length produced by Java-JWT doesn't match the definition in RFC7518 https://tools.ietf.org/html/rfc7518#page-10. It is expected that the signature is 64 bytes, but its 71 or 72, probably related to DER encoding.
When validating a signature ECDSAAlgorithm makes JOSEToDER. Shouldn't it make DERToJOSE when creating signatures?
Cheers, Ivo Kolev
The text was updated successfully, but these errors were encountered: