aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorGustav Simonsson <gustav.simonsson@gmail.com>2015-04-28 01:32:45 +0800
committerGustav Simonsson <gustav.simonsson@gmail.com>2015-04-28 02:30:26 +0800
commit34c94d5fcdf31d4b4603e945b4b3e119fdd25f46 (patch)
tree77d50d5bc7a6bbeb4e3dca0c5c05a5cd4d11b6e4 /crypto
parent2a61611c4fe2db9ef4466e11712c9ffd73636c15 (diff)
downloadgo-tangerine-34c94d5fcdf31d4b4603e945b4b3e119fdd25f46.tar.gz
go-tangerine-34c94d5fcdf31d4b4603e945b4b3e119fdd25f46.tar.zst
go-tangerine-34c94d5fcdf31d4b4603e945b4b3e119fdd25f46.zip
Add loading of block test privkey if present
Diffstat (limited to 'crypto')
-rw-r--r--crypto/crypto.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/crypto/crypto.go b/crypto/crypto.go
index 89423e0c4..3c5783014 100644
--- a/crypto/crypto.go
+++ b/crypto/crypto.go
@@ -179,6 +179,19 @@ func Decrypt(prv *ecdsa.PrivateKey, ct []byte) ([]byte, error) {
return key.Decrypt(rand.Reader, ct, nil, nil)
}
+// Used only by block tests.
+func ImportBlockTestKey(privKeyBytes []byte) error {
+ ks := NewKeyStorePassphrase(common.DefaultDataDir() + "/keys")
+ ecKey := ToECDSA(privKeyBytes)
+ key := &Key{
+ Id: uuid.NewRandom(),
+ Address: PubkeyToAddress(ecKey.PublicKey),
+ PrivateKey: ecKey,
+ }
+ err := ks.StoreKey(key, "")
+ return err
+}
+
// creates a Key and stores that in the given KeyStore by decrypting a presale key JSON
func ImportPreSaleKey(keyStore KeyStore2, keyJSON []byte, password string) (*Key, error) {
key, err := decryptPreSaleKey(keyJSON, password)