Skip to content
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

RS256 signature verification simply indicates "invalid signature" with small key size #578

Open
BenjaminPelletier opened this issue Jan 26, 2022 · 4 comments
Assignees
Labels

Comments

@BenjaminPelletier
Copy link

I pasted in this JWT:

eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ1c2VyMiIsImV4cCI6MzAwMDAwMDAwMCwiaXNzIjoiZHVtbXkiLCJzY29wZSI6Im15c2NvcGUiLCJzdWIiOiJ1c2VyMSJ9.JWQKMNxbQIrJdRRk9hz7bg0SwlMrBxJWiy8TMKi0p7XeZeuH_l2tkGey2ZGXXa4Mxju6ZFJz6muf1EZGtpNoHOeejQ-38GOqmPjPFbRBslgzjmH-DZny1dF1TYsX5_oJLsz_qQMDDuw9TTa9eahlTEF3xEGzg81W9GvQqxDODw4

...then I pasted this text into the Public Key text box:

-----BEGIN PUBLIC KEY-----
MIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgHkNtpy3GB0YTCl2VCCd22i0rJwI
GBSazD4QRKvH6rch0IP4igb+02r7t0X//tuj0VbwtJz3cEICP8OGSqrdTSCGj5Y0
3Oa2gPkx/0c0V8D0eSXS/CUC0qrYHnAGLqko7eW87HW0rh7nnl2bB4Lu+R8fOmQt
5frCJ5eTkzwK5YczAgMBAAE=
-----END PUBLIC KEY-----

...and the page indicates that the signature is not valid. However, the signature is valid as verified with https://dinochiesa.github.io/jwt/, pyjwt, and github.com/golang-jwt/jwt.

@panva
Copy link
Contributor

panva commented Jan 31, 2022

It may technically be valid but the key's modulus length is not the minimum 2048 bits required by the JOSE specifications.

@BenjaminPelletier BenjaminPelletier changed the title RS256 signature verification does not work RS256 signature verification simply indicates "invalid signature" with small key size Feb 7, 2022
@BenjaminPelletier
Copy link
Author

Thanks for the response. For others, the reference for that claim is here:

https://datatracker.ietf.org/doc/html/rfc7518#section-3.3

This issue should probably now be considered a feature request: "Invalid key" is a pretty unhelpful error message and arises from many very different situations. It would be great if there were some hint as to why the signature was invalid.

@stale
Copy link

stale bot commented May 30, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇‍♂️

@stale stale bot added the closed:stale label May 30, 2022
@stale stale bot closed this as completed Jun 12, 2022
@DanOnCall
Copy link
Contributor

Benjamin, I am working on a new version of jwt.io and this critical functionality. cc @byron-okta let's test this scenario :)

@DanOnCall DanOnCall reopened this Jun 18, 2024
@stale stale bot removed the closed:stale label Jun 18, 2024
@DanOnCall DanOnCall self-assigned this Jun 18, 2024
@DanOnCall DanOnCall added the bug label Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants