Skip to content

Commit

Permalink
Merge pull request #2256 from CortexFoundation/dev
Browse files Browse the repository at this point in the history
crypto: add IsOnCurve check
  • Loading branch information
ucwong authored Jan 31, 2025
2 parents 57cfa59 + 85dde7e commit 4b62543
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 @@ -179,6 +179,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 4b62543

Please sign in to comment.