aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/key_store_plain.go
diff options
context:
space:
mode:
authorGustav Simonsson <gustav.simonsson@gmail.com>2015-04-21 23:00:30 +0800
committerGustav Simonsson <gustav.simonsson@gmail.com>2015-05-12 23:22:17 +0800
commitf98e002d9851b8df53a09a0e3189f2e8fdec48df (patch)
tree611b0f65f80cee91c62716ae18f43aaaed61bc96 /crypto/key_store_plain.go
parent313eec33ad7add82bfdd00e3a076091fa990c799 (diff)
downloaddexon-f98e002d9851b8df53a09a0e3189f2e8fdec48df.tar.gz
dexon-f98e002d9851b8df53a09a0e3189f2e8fdec48df.tar.zst
dexon-f98e002d9851b8df53a09a0e3189f2e8fdec48df.zip
Address pull request comments; key header and hex encoding
* Remove key header from unencrypted key file format and replace it with a version field * Change encoding of bytes in key files from base64 to hex
Diffstat (limited to 'crypto/key_store_plain.go')
-rw-r--r--crypto/key_store_plain.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/key_store_plain.go b/crypto/key_store_plain.go
index 2ade11985..6a8afe27d 100644
--- a/crypto/key_store_plain.go
+++ b/crypto/key_store_plain.go
@@ -98,12 +98,12 @@ func (ks keyStorePlain) DeleteKey(keyAddr common.Address, auth string) (err erro
}
func GetKeyFile(keysDirPath string, keyAddr common.Address) (fileContent []byte, err error) {
- fileName := keyAddr.Hex()
+ fileName := hex.EncodeToString(keyAddr[:])
return ioutil.ReadFile(filepath.Join(keysDirPath, fileName, fileName))
}
func WriteKeyFile(addr common.Address, keysDirPath string, content []byte) (err error) {
- addrHex := addr.Hex()
+ addrHex := hex.EncodeToString(addr[:])
keyDirPath := filepath.Join(keysDirPath, addrHex)
keyFilePath := filepath.Join(keyDirPath, addrHex)
err = os.MkdirAll(keyDirPath, 0700) // read, write and dir search for user