aboutsummaryrefslogtreecommitdiffstats
path: root/internal/ethapi
diff options
context:
space:
mode:
authorFelix Lange <fjl@users.noreply.github.com>2017-05-25 04:30:47 +0800
committerGitHub <noreply@github.com>2017-05-25 04:30:47 +0800
commitef25b826e655f8e6a57fc7a05454bf356382bd5f (patch)
treec843d8b5ca0064804e55f5d66dd910c0c106fc05 /internal/ethapi
parent261b3e235160d30cc7176e02fd0a43f2b60409c6 (diff)
parent136f78ff0a324f7f79296143a6ab7c2dd8a2c37d (diff)
downloadgo-tangerine-ef25b826e655f8e6a57fc7a05454bf356382bd5f.tar
go-tangerine-ef25b826e655f8e6a57fc7a05454bf356382bd5f.tar.gz
go-tangerine-ef25b826e655f8e6a57fc7a05454bf356382bd5f.tar.bz2
go-tangerine-ef25b826e655f8e6a57fc7a05454bf356382bd5f.tar.lz
go-tangerine-ef25b826e655f8e6a57fc7a05454bf356382bd5f.tar.xz
go-tangerine-ef25b826e655f8e6a57fc7a05454bf356382bd5f.tar.zst
go-tangerine-ef25b826e655f8e6a57fc7a05454bf356382bd5f.zip
Merge pull request #14502 from karalabe/mobile-import-ecdsa
Enforce 256 bit keys on raw import, support raw mobile imports
Diffstat (limited to 'internal/ethapi')
-rw-r--r--internal/ethapi/api.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go
index 62edc695c..a22c15eca 100644
--- a/internal/ethapi/api.go
+++ b/internal/ethapi/api.go
@@ -19,7 +19,6 @@ package ethapi
import (
"bytes"
"context"
- "encoding/hex"
"errors"
"fmt"
"math/big"
@@ -283,12 +282,11 @@ func fetchKeystore(am *accounts.Manager) *keystore.KeyStore {
// ImportRawKey stores the given hex encoded ECDSA key into the key directory,
// encrypting it with the passphrase.
func (s *PrivateAccountAPI) ImportRawKey(privkey string, password string) (common.Address, error) {
- hexkey, err := hex.DecodeString(privkey)
+ key, err := crypto.HexToECDSA(privkey)
if err != nil {
return common.Address{}, err
}
-
- acc, err := fetchKeystore(s.am).ImportECDSA(crypto.ToECDSA(hexkey), password)
+ acc, err := fetchKeystore(s.am).ImportECDSA(key, password)
return acc.Address, err
}