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
This commit is contained in:
Gustav Simonsson
2015-04-21 17:00:30 +02:00
parent 313eec33ad
commit f98e002d98
3 changed files with 67 additions and 31 deletions

View File

@ -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