Merge pull request #658 from Gustav-Simonsson/add_ec_point_on_curve_check

Add IsOnCurve check to EC unmarshalling in ECIES decryption
This commit is contained in:
Jeffrey Wilcke 2015-04-08 00:51:12 +02:00
commit 7c0a18edb5
1 changed files with 4 additions and 0 deletions

View File

@ -303,6 +303,10 @@ func (prv *PrivateKey) Decrypt(rand io.Reader, c, s1, s2 []byte) (m []byte, err
err = ErrInvalidPublicKey err = ErrInvalidPublicKey
return return
} }
if !R.Curve.IsOnCurve(R.X, R.Y) {
err = ErrInvalidCurve
return
}
z, err := prv.GenerateShared(R, params.KeyLen, params.KeyLen) z, err := prv.GenerateShared(R, params.KeyLen, params.KeyLen)
if err != nil { if err != nil {