From 1f99eff9e31fc65534d700858952f0dad68062d2 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 8 Dec 2017 16:04:00 +0100 Subject: [PATCH] crypto: add test for valid signature + invalid pubkey --- crypto/signature_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crypto/signature_test.go b/crypto/signature_test.go index 2e67f6f76f..5e2efc7e05 100644 --- a/crypto/signature_test.go +++ b/crypto/signature_test.go @@ -68,6 +68,11 @@ func TestVerifySignature(t *testing.T) { if VerifySignature(testpubkey, testmsg, sig[:len(sig)-2]) { t.Errorf("signature valid even though it's incomplete") } + wrongkey := common.CopyBytes(testpubkey) + wrongkey[10]++ + if VerifySignature(wrongkey, testmsg, sig) { + t.Errorf("signature valid with with wrong public key") + } } func TestDecompressPubkey(t *testing.T) {