crypto: add IsOnCurve check

This commit is contained in:
Manav Darji 2025-01-30 18:41:32 +05:30
parent ceb62bb9d3
commit 573c343d54
No known key found for this signature in database
GPG key ID: A426F0124435F36E

View file

@ -189,6 +189,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
}