kelvinmo/simplejwt

issue on ECKey instantiation

secioss-git opened this issue · 4 comments

When using Prime 256 key the length of x and y should both be 32 byte.
but when dump key object, i got 31 and 33 byte of x and y.

Sample dump is here
object(SimpleJWT\Keys\ECKey)#1 (1) {
["data":protected]=>
array(6) {
["kty"]=>
string(2) "EC"
["crv"]=>
string(5) "P-256"
["d"]=>
string(43) "MCLUMijLCR8uuVrjgZxaMWtHnElEPhewa1vLEouThZc"
["x"]=>
string(42) "7ctn9jXL_oYnSE_jwiDyI3mxEy4s2CxbIYB_i5tmSg"
["y"]=>
string(44) "zuUFbsHCKVZhZ13IZMluI0lDXhzQkNy7MO-cYK7sWdiK"
["kid"]=>
string(6) "example"
}
}

Would you be able to send through the PEM form of this key?

Here is the pem file.

-----BEGIN EC PARAMETERS-----
BggqhkjOPQMBBw==
-----END EC PARAMETERS-----
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIDAi1DIoywkfLrla44GcWjFrR5xJRD4XsGtbyxKLk4WXoAoGCCqGSM49
AwEHoUQDQgAE7ctn9jXL/oYnSE/jwiDyI3mxEy4s2CxbIYB/i5tmSs7lBW7BwilW
YWddyGTJbiNJQ14c0JDcuzDvnGCu7FnYig==
-----END EC PRIVATE KEY-----

This should be fixed in 18943a6

The fix works fine. Thank you very much.