You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The leading zero is missing, meaning the resulting base64 becomes j7evyaXiB7W7Xcw1VcDrAbuLbU4OttJphHacZBuAzMo instead of the expected blYhrm9qF1QjcvW-PCH4EI6gqOq6p1fcH8eCuxaT0WU.
It can be solved by using key.X.FillBytes(...) instead of Bytes() in order to ensure that the byte array is of the correct size. The expected size varies based on the curve:
P-256: 32 bytes
P-384: 48 bytes
P-521: 66 bytes
I have only checked elliptic curve JWKs. The same error might apply to RSA JWKs as well.
)
When creating and using JWK representations the byte array is padded at
the start with 0x00 to ensure that all hashes of the JWK will be
correct.
When calculating the hashed token in `parse.go` and when creating proofs
in `create.go` the `FillBytes(buf []byte)` function is used on the
big.Int to get the byte array representation with added zeros at the
start.
- Fixes#21
Contact Details
No response
Describe the bug
Given the following JWK:
The JWK has an "x" coordinate. The byte array representation of this field is:
This array is passed to a big int: (https://github.com/AxisCommunications/go-dpop/blob/a885cee9d8111680bc1aa09e95d2452eb87cc6c1/parse.go#L208)
It's then converted back into a byte array in order to be encoded as base64: (https://github.com/AxisCommunications/go-dpop/blob/a885cee9d8111680bc1aa09e95d2452eb87cc6c1/parse.go#L279)
The result of
key.X.Bytes()
is the following byte array:The leading zero is missing, meaning the resulting base64 becomes
j7evyaXiB7W7Xcw1VcDrAbuLbU4OttJphHacZBuAzMo
instead of the expectedblYhrm9qF1QjcvW-PCH4EI6gqOq6p1fcH8eCuxaT0WU
.It can be solved by using
key.X.FillBytes(...)
instead ofBytes()
in order to ensure that the byte array is of the correct size. The expected size varies based on the curve:I have only checked elliptic curve JWKs. The same error might apply to RSA JWKs as well.
Steps to reproduce the behavior
Create a thumbprint from the following JWK:
The thumbprint should be
blYhrm9qF1QjcvW-PCH4EI6gqOq6p1fcH8eCuxaT0WU
.OS
No response
Relevant log output
No response
Additional Notes
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: