-
Notifications
You must be signed in to change notification settings - Fork 133
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
EC256 signature is incompatible with RFC-7518 #94
Comments
Confirmed ES256, ES384 .. not signed as described in RFC-7518. I just realized the same issue with another PHP lib ... test case:
|
Hey guys, would you mind sending a PR for this to get fixed? We mostly use RSA so I dont have a good hang of how ECDSA works :) |
This is a reference in Java which can be stacked on top on current OpenSSl impl: |
This is my impl for ES384:
|
hey @ishitatsuyuki would you mind sending a PR? We mostly use RSA so I dont have a good hang of how the ES family works :) |
I have only implemented verify only and not sure where to insert these code by your design. This is just converting between sign format, thus you don't have to understand how it works. Please take a look at the reference Java code. |
I think I've managed to build a more clear, universal and bidirectional (sign & verify) solution, however I'd like to keep it private until it's tested against at least one known-good implementation. As the only other library I'm firm with (jsrsasign) seems to have the same problem (expects ASN1), could someone contact me to test my implementation? (That's why I want to keep it private, I think it's a very bad idea to just publish another non-standard, non-working Implementation which only brings massive confusion.) As soon as it's tested, I'll send a PR - that's why I wrote it. |
Have a look on my PHP library to deal with that bug. I hope it will help you. |
@Spomky That's the first thing I've considered when facing this bug, however I'd like to avoid |
You don't need GMP. Look at https://github.com/Spomky-Labs/jose/blob/master/src/Algorithm/Signature/ECDSA.php#L52 The method that uses GMP is just a fallback in case openssl does not support EC signatures |
@Spomky is it possible to open a PR against this repo? |
@Spomky Isn't |
You are right fgrosse/phpasn1 requires GMP. |
phpseclib ;-) |
The library creates ES256 JWS signature as DER encoded ASN1 sequence, but it have to be concatenated R and S ECPoints.
See https://tools.ietf.org/html/rfc7518#section-3.4
The problem code is https://github.com/namshi/jose/blob/master/src/Namshi/JOSE/Signer/OpenSSL/PublicKey.php#L25
The right example is
https://github.com/lcobucci/jwt/blob/master/src/Signer/Ecdsa.php#L82
With best wishes, Roman
The text was updated successfully, but these errors were encountered: