-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
ECKey::convertPublicKeyToPEM() creates invalid public keys #475
Comments
Hi @ms2ad, Many thanks for this detailed report. What application/library generated those keys? |
Hi @Spomky, thank you for the quick response. These keys are provided by Google itself, see https://play.google.com/newsstand/api/v3/articleaccess/publicsigningkey/dev and https://play.google.com/newsstand/api/v3/articleaccess/publicsigningkey. |
I created a PR to solve this problem. But it is worth to warn Google that an extra byte is present in the generated keys. |
I will check it out locally! |
@Spomky I can confirm that the fix resolves our issue. Thank you very much! |
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. |
Version(s) affected
3.2.7
Description
We have a specific URL, a signature and a set JWKs from Google https://play.google.com/newsstand/api/v3/articleaccess/publicsigningkey/dev to verify the signature.
When trying to verify the signature,
jwt-framework/src/SignatureAlgorithm/ECDSA/ECDSA.php
Line 50 in 227990b
thus verifying the signature always fails.
We compared how
web-token/jwt-framework
converts the JWK into a public key to how https://8gwifi.org/jwkconvertfunctions.jsp and how https://www.npmjs.com/package/jwk-to-pem does it and while https://8gwifi.org/jwkconvertfunctions.jsp and https://www.npmjs.com/package/jwk-to-pem create the same public key, thatopenssl ec -inform PEM -pubin -in public.pem -text -noout
can properly process,web-token/jwt-framework
creates an invalid public key, that openssl fails to read:The same problem also arises when JWKs from https://play.google.com/newsstand/api/v3/articleaccess/publicsigningkey are converted.
How to reproduce
Execute
and try verifying the keys with
openssl ec -inform PEM -pubin -in public.pem -text -noout
, compare keys to https://8gwifi.org/jwkconvertfunctions.jsp.Possible Solution
No response
Additional Context
Example conversion comparison:
The text was updated successfully, but these errors were encountered: