From fa0537758fd715d33594ab6a27c9a0e9143949cc Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 25 Dec 2019 18:01:54 +0300 Subject: [PATCH] keys: add a test for X/Y > P decoding case --- pkg/crypto/keys/publickey_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/crypto/keys/publickey_test.go b/pkg/crypto/keys/publickey_test.go index 98a73a40f..d3f316b28 100644 --- a/pkg/crypto/keys/publickey_test.go +++ b/pkg/crypto/keys/publickey_test.go @@ -69,6 +69,12 @@ func TestDecodeFromStringBadCompressed(t *testing.T) { require.Error(t, err) } +func TestDecodeFromStringBadXMoreThanP(t *testing.T) { + str := "02ffffffff00000001000000000000000000000001ffffffffffffffffffffffff" + _, err := NewPublicKeyFromString(str) + require.Error(t, err) +} + func TestDecodeFromStringNotOnCurve(t *testing.T) { str := "04ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" _, err := NewPublicKeyFromString(str)