aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/crypto_test.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-23 01:12:05 +0800
committerobscuren <geffobscura@gmail.com>2015-01-23 01:12:05 +0800
commitd4cc2d3503ce7497ef0cb39456a332b25e0999b9 (patch)
tree7eefc6366630a571eeaf724d4be5972cc7e06302 /crypto/crypto_test.go
parentb777d6aa3f0e771ca8465924820db1848bc47402 (diff)
downloaddexon-d4cc2d3503ce7497ef0cb39456a332b25e0999b9.tar
dexon-d4cc2d3503ce7497ef0cb39456a332b25e0999b9.tar.gz
dexon-d4cc2d3503ce7497ef0cb39456a332b25e0999b9.tar.bz2
dexon-d4cc2d3503ce7497ef0cb39456a332b25e0999b9.tar.lz
dexon-d4cc2d3503ce7497ef0cb39456a332b25e0999b9.tar.xz
dexon-d4cc2d3503ce7497ef0cb39456a332b25e0999b9.tar.zst
dexon-d4cc2d3503ce7497ef0cb39456a332b25e0999b9.zip
Pad private key when signing & length check for hashes in sign
Diffstat (limited to 'crypto/crypto_test.go')
-rw-r--r--crypto/crypto_test.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/crypto/crypto_test.go b/crypto/crypto_test.go
index 349bc31ae..441733f93 100644
--- a/crypto/crypto_test.go
+++ b/crypto/crypto_test.go
@@ -52,7 +52,7 @@ func BenchmarkSha3(b *testing.B) {
}
func Test0Key(t *testing.T) {
-
+ t.Skip()
key := ethutil.Hex2Bytes("1111111111111111111111111111111111111111111111111111111111111111")
p, err := secp256k1.GeneratePubKey(key)
@@ -60,3 +60,15 @@ func Test0Key(t *testing.T) {
fmt.Printf("%x\n", p)
fmt.Printf("%v %x\n", err, addr)
}
+
+func TestInvalidSign(t *testing.T) {
+ _, err := Sign(make([]byte, 1), nil)
+ if err == nil {
+ t.Errorf("expected sign with hash 1 byte to error")
+ }
+
+ _, err = Sign(make([]byte, 33), nil)
+ if err == nil {
+ t.Errorf("expected sign with hash 33 byte to error")
+ }
+}