Skip to content

Commit

Permalink
add IsOnCurve check when Unmarshaling
Browse files Browse the repository at this point in the history
  • Loading branch information
0xhashiman committed Feb 1, 2025
1 parent 33226b8 commit 0c01c9b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crypto/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ func UnmarshalPubkey(pub []byte) (*ecdsa.PublicKey, error) {
if x == nil {
return nil, errInvalidPubkey
}
if !S256().IsOnCurve(x, y) {
return nil, errInvalidPubkey
}
return &ecdsa.PublicKey{Curve: S256(), X: x, Y: y}, nil
}

Expand Down

0 comments on commit 0c01c9b

Please sign in to comment.