crypto: add IsOnCurve check

This commit is contained in:
Felix Lange 2025-01-30 14:07:56 +01:00
parent 7d0e197def
commit 9f4b19555f

View file

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