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

Commit

Permalink
Fix error message for incorrect pubkey x/y length.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jsha authored and csstaub committed Oct 22, 2019
1 parent 4b3c0f5 commit fe1ef12
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jwk.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,11 @@ func (key rawJSONWebKey) ecPublicKey() (*ecdsa.PublicKey, error) {
// the curve specified in the "crv" parameter.
// https://tools.ietf.org/html/rfc7518#section-6.2.1.2
if curveSize(curve) != len(key.X.data) {
return nil, fmt.Errorf("square/go-jose: invalid EC private key, wrong length for x")
return nil, fmt.Errorf("square/go-jose: invalid EC public key, wrong length for x")
}

if curveSize(curve) != len(key.Y.data) {
return nil, fmt.Errorf("square/go-jose: invalid EC private key, wrong length for y")
return nil, fmt.Errorf("square/go-jose: invalid EC public key, wrong length for y")
}

x := key.X.bigInt()
Expand Down

0 comments on commit fe1ef12

Please sign in to comment.