diff options
Diffstat (limited to 'crypto/key_store_test.go')
-rw-r--r-- | crypto/key_store_test.go | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/crypto/key_store_test.go b/crypto/key_store_test.go index 54efc739a..485d8f536 100644 --- a/crypto/key_store_test.go +++ b/crypto/key_store_test.go @@ -1,7 +1,7 @@ package crypto import ( - crand "crypto/rand" + "github.com/ethereum/go-ethereum/crypto/randentropy" "reflect" "testing" ) @@ -9,18 +9,18 @@ import ( func TestKeyStorePlain(t *testing.T) { ks := NewKeyStorePlain(DefaultDataDir()) pass := "" // not used but required by API - k1, err := ks.GenerateNewKey(crand.Reader, pass) + k1, err := ks.GenerateNewKey(randentropy.Reader, pass) if err != nil { t.Fatal(err) } k2 := new(Key) - k2, err = ks.GetKey(k1.Id, pass) + k2, err = ks.GetKey(k1.Address, pass) if err != nil { t.Fatal(err) } - if !reflect.DeepEqual(k1.Id, k2.Id) { + if !reflect.DeepEqual(k1.Address, k2.Address) { t.Fatal(err) } @@ -28,7 +28,7 @@ func TestKeyStorePlain(t *testing.T) { t.Fatal(err) } - err = ks.DeleteKey(k2.Id, pass) + err = ks.DeleteKey(k2.Address, pass) if err != nil { t.Fatal(err) } @@ -37,16 +37,16 @@ func TestKeyStorePlain(t *testing.T) { func TestKeyStorePassphrase(t *testing.T) { ks := NewKeyStorePassphrase(DefaultDataDir()) pass := "foo" - k1, err := ks.GenerateNewKey(crand.Reader, pass) + k1, err := ks.GenerateNewKey(randentropy.Reader, pass) if err != nil { t.Fatal(err) } k2 := new(Key) - k2, err = ks.GetKey(k1.Id, pass) + k2, err = ks.GetKey(k1.Address, pass) if err != nil { t.Fatal(err) } - if !reflect.DeepEqual(k1.Id, k2.Id) { + if !reflect.DeepEqual(k1.Address, k2.Address) { t.Fatal(err) } @@ -54,7 +54,7 @@ func TestKeyStorePassphrase(t *testing.T) { t.Fatal(err) } - err = ks.DeleteKey(k2.Id, pass) // also to clean up created files + err = ks.DeleteKey(k2.Address, pass) // also to clean up created files if err != nil { t.Fatal(err) } @@ -63,22 +63,22 @@ func TestKeyStorePassphrase(t *testing.T) { func TestKeyStorePassphraseDecryptionFail(t *testing.T) { ks := NewKeyStorePassphrase(DefaultDataDir()) pass := "foo" - k1, err := ks.GenerateNewKey(crand.Reader, pass) + k1, err := ks.GenerateNewKey(randentropy.Reader, pass) if err != nil { t.Fatal(err) } - _, err = ks.GetKey(k1.Id, "bar") // wrong passphrase + _, err = ks.GetKey(k1.Address, "bar") // wrong passphrase if err == nil { t.Fatal(err) } - err = ks.DeleteKey(k1.Id, "bar") // wrong passphrase + err = ks.DeleteKey(k1.Address, "bar") // wrong passphrase if err == nil { t.Fatal(err) } - err = ks.DeleteKey(k1.Id, pass) // to clean up + err = ks.DeleteKey(k1.Address, pass) // to clean up if err != nil { t.Fatal(err) } |