Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Add checks for octet length of X, Y, and D #210

Merged
merged 4 commits into from
Dec 5, 2018
Merged

Conversation

jsha
Copy link
Contributor

@jsha jsha commented Dec 5, 2018

The JWK spec says these fields in EC keys MUST be a fixed length, but go-jose wasn't
checking their length on input. I got a report from the Let's Encrypt forums that this
caused some confusion with certain software that was generating invalid JWKs. Boulder
(using go-jose) ingested those keys just fine, but output a different (valid) encoding.

This change enforces the correct length on parsing. It also changes some t.Errorf to
t.Fatalf that I noticed during testing. The t.Fatalf checks are for failures that prevent
the test from meaningfully continuing.

@CLAassistant
Copy link

CLAassistant commented Dec 5, 2018

CLA assistant check
All committers have signed the CLA.

@csstaub
Copy link
Collaborator

csstaub commented Dec 5, 2018

This looks good to me. Thank you @jsha!

@csstaub csstaub merged commit 7241509 into square:v2 Dec 5, 2018
@csstaub
Copy link
Collaborator

csstaub commented Dec 5, 2018

(I'll release this in a v2.2.1 later today)

jsha added a commit to jsha/go-jose that referenced this pull request Jun 26, 2019
In square#210 I introduced some error messages for incorrect octet string
length for X and Y. The error message for the public key case
incorrectly stated that it was for a private key.
csstaub pushed a commit that referenced this pull request Oct 22, 2019
In #210 I introduced some error messages for incorrect octet string
length for X and Y. The error message for the public key case
incorrectly stated that it was for a private key.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants