-
-
Notifications
You must be signed in to change notification settings - Fork 691
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
P-521 Coordinates (x,y) are expected to be the same length and equal which is not always true #709
Comments
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
This looks like a valid issue to me. |
Seems like the proper fix is in |
Can we reopen? |
In case it helps, here's a rouch sketch of how I solved it for
|
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
The same thing can happen for P-256 too, except with the length having to be 32 For testing I'm using this self-signed certificate
|
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* add option to exclude x5* Signed-off-by: Jens Langhammer <jens@goauthentik.io> #4082 * cleanup jwks, add flaky test Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add workaround based on jpadilla/pyjwt#709 Signed-off-by: Jens Langhammer <jens@goauthentik.io> * don't rstrip hashes Signed-off-by: Jens Langhammer <jens@goauthentik.io> * keycloak seems to strip equals Signed-off-by: Jens Langhammer <jens@goauthentik.io> Signed-off-by: Jens Langhammer <jens@goauthentik.io>
this solution worked for me. Would be good to get it merge in. Note I generated my key with
|
I get this issue when converting a p-512 jwt to key with |
@vancouverwill I suspect that's an issue with jose4j, but I can't seem to find the source code to check (is it proprietary?). It would probably be helpful to have a "loose" mode for from_key that accepts keys that don't respect the minimum length requirements of the spec (since so many implementations seem to miss it). EDIT: Found the source code, and if I'm reading it correctly, it looks like they have the same bug here: https://github.com/RbkGh/Jose4j/blob/c66ffa2859db44a86f064d2251e639204ceabbb7/src/main/java/org/jose4j/jwk/PublicJsonWebKey.java#L243 (Notice how they don't add any padding) |
when decoding JWT tokens issued by keycloak I have come across x and y coordinate lengths 65 and 66 respectively and when this happens pyjwt throws this error.
Expected Result
It should allow coordinate lengths in [64, 66]
Ref: https://stackoverflow.com/questions/50002149/why-p-521-public-key-x-y-some-time-is-65-bytes-some-time-is-66-bytes
Actual Result
The library raised an invalid key error
Reproduction Steps
This example pointing to an internal keycloak deployment.
System Information
This command is only available on PyJWT v1.6.3 and greater. Otherwise,
please provide some basic information about your system.
The text was updated successfully, but these errors were encountered: