diff options
Diffstat (limited to 'crypto/crypto.go')
-rw-r--r-- | crypto/crypto.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/crypto.go b/crypto/crypto.go index 8161769d3..3a98bfb50 100644 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -98,6 +98,9 @@ func toECDSA(d []byte, strict bool) (*ecdsa.PrivateKey, error) { } priv.D = new(big.Int).SetBytes(d) priv.PublicKey.X, priv.PublicKey.Y = priv.PublicKey.Curve.ScalarBaseMult(d) + if priv.PublicKey.X == nil { + return nil, errors.New("invalid private key") + } return priv, nil } |