aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/key_store_passphrase.go
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/key_store_passphrase.go')
-rw-r--r--crypto/key_store_passphrase.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/key_store_passphrase.go b/crypto/key_store_passphrase.go
index 00717b5d1..96227e4d1 100644
--- a/crypto/key_store_passphrase.go
+++ b/crypto/key_store_passphrase.go
@@ -153,7 +153,7 @@ func (ks keyStorePassphrase) StoreKey(key *Key, auth string) (err error) {
keyHeaderJSON := keyHeaderJSON{
Version: keyHeaderVersion,
Kdf: keyHeaderKDF,
- KdfParams: paramsJSON,
+ KdfParams: &paramsJSON,
}
keyHeaderJSONStr, err := json.Marshal(keyHeaderJSON)
@@ -167,12 +167,12 @@ func (ks keyStorePassphrase) StoreKey(key *Key, auth string) (err error) {
mac,
salt,
iv,
- keyHeaderJSON,
cipherText,
}
keyStruct := encryptedKeyJSON{
key.Id,
key.Address.Bytes(),
+ keyHeaderJSON,
cipherStruct,
}
keyJSON, err := json.Marshal(keyStruct)
@@ -204,10 +204,11 @@ func DecryptKey(ks keyStorePassphrase, keyAddr common.Address, auth string) (key
err = json.Unmarshal(fileContent, keyProtected)
keyId = keyProtected.Id
+ keyHeader := keyProtected.KeyHeader
+
mac := keyProtected.Crypto.MAC
salt := keyProtected.Crypto.Salt
iv := keyProtected.Crypto.IV
- keyHeader := keyProtected.Crypto.KeyHeader
cipherText := keyProtected.Crypto.CipherText
// used in MAC