aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/keystore/key.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-05-23 19:58:03 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-05-23 19:58:03 +0800
commitaa73420207cba02a68befdbb8667f1e6ceed3f4d (patch)
tree76b4fb7ffc9440e7ff27b22dc367355d4fc84f5c /accounts/keystore/key.go
parent3556962053267def82f1a9f9e97a26f7b7c1450e (diff)
downloaddexon-aa73420207cba02a68befdbb8667f1e6ceed3f4d.tar.gz
dexon-aa73420207cba02a68befdbb8667f1e6ceed3f4d.tar.zst
dexon-aa73420207cba02a68befdbb8667f1e6ceed3f4d.zip
accounts/keystore, crypto: enforce 256 bit keys on import
Diffstat (limited to 'accounts/keystore/key.go')
-rw-r--r--accounts/keystore/key.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/accounts/keystore/key.go b/accounts/keystore/key.go
index 292b47b44..ecc955d74 100644
--- a/accounts/keystore/key.go
+++ b/accounts/keystore/key.go
@@ -124,14 +124,13 @@ func (k *Key) UnmarshalJSON(j []byte) (err error) {
if err != nil {
return err
}
-
- privkey, err := hex.DecodeString(keyJSON.PrivateKey)
+ privkey, err := crypto.HexToECDSA(keyJSON.PrivateKey)
if err != nil {
return err
}
k.Address = common.BytesToAddress(addr)
- k.PrivateKey = crypto.ToECDSA(privkey)
+ k.PrivateKey = privkey
return nil
}