aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/secp256k1/secp256_test.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-11-24 20:48:47 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-11-24 20:48:47 +0800
commit5490437942967638bcc6198035315f6811febaa8 (patch)
treeec4fbee454bacbf2b80b5a7ff402fb48dd2c10cf /crypto/secp256k1/secp256_test.go
parente5532154a50114d5ffb1ffd850b746cab00cb899 (diff)
parentb0fb48c389460193d9fc0a5118d79ff6dec48ce0 (diff)
downloadgo-tangerine-1.3.2.tar
go-tangerine-1.3.2.tar.gz
go-tangerine-1.3.2.tar.bz2
go-tangerine-1.3.2.tar.lz
go-tangerine-1.3.2.tar.xz
go-tangerine-1.3.2.tar.zst
go-tangerine-1.3.2.zip
Merge branch 'develop' into release/1.3.2v1.3.2
Conflicts: VERSION cmd/geth/main.go
Diffstat (limited to 'crypto/secp256k1/secp256_test.go')
-rw-r--r--crypto/secp256k1/secp256_test.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/crypto/secp256k1/secp256_test.go b/crypto/secp256k1/secp256_test.go
index 45c448f3c..cb71ea5e7 100644
--- a/crypto/secp256k1/secp256_test.go
+++ b/crypto/secp256k1/secp256_test.go
@@ -56,6 +56,17 @@ func TestSignatureValidity(t *testing.T) {
}
}
+func TestInvalidRecoveryID(t *testing.T) {
+ _, seckey := GenerateKeyPair()
+ msg := randentropy.GetEntropyCSPRNG(32)
+ sig, _ := Sign(msg, seckey)
+ sig[64] = 99
+ _, err := RecoverPubkey(msg, sig)
+ if err != ErrInvalidRecoveryID {
+ t.Fatalf("got %q, want %q", err, ErrInvalidRecoveryID)
+ }
+}
+
func TestSignAndRecover(t *testing.T) {
pubkey1, seckey := GenerateKeyPair()
msg := randentropy.GetEntropyCSPRNG(32)
@@ -70,10 +81,6 @@ func TestSignAndRecover(t *testing.T) {
if !bytes.Equal(pubkey1, pubkey2) {
t.Errorf("pubkey mismatch: want: %x have: %x", pubkey1, pubkey2)
}
- err = VerifySignature(msg, sig, pubkey1)
- if err != nil {
- t.Errorf("signature verification error: %s", err)
- }
}
func TestRandomMessagesWithSameKey(t *testing.T) {