aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/key.go
diff options
context:
space:
mode:
authorGustav Simonsson <gustav.simonsson@gmail.com>2015-04-21 21:52:10 +0800
committerGustav Simonsson <gustav.simonsson@gmail.com>2015-05-12 23:19:39 +0800
commit313eec33ad7add82bfdd00e3a076091fa990c799 (patch)
treea6aaf9167c122e7357b7c2c55251068325021056 /crypto/key.go
parent8754f2b768ba00d8507a7990dccca80e6cea1cc0 (diff)
downloadgo-tangerine-313eec33ad7add82bfdd00e3a076091fa990c799.tar.gz
go-tangerine-313eec33ad7add82bfdd00e3a076091fa990c799.tar.zst
go-tangerine-313eec33ad7add82bfdd00e3a076091fa990c799.zip
Revert "Add key header to unencrypted key file"
This reverts commit a94d4ba0b53c4558ab838aaed635a2ff66ddfa53.
Diffstat (limited to 'crypto/key.go')
-rw-r--r--crypto/key.go17
1 files changed, 5 insertions, 12 deletions
diff --git a/crypto/key.go b/crypto/key.go
index 0f36a7f6b..067a5a294 100644
--- a/crypto/key.go
+++ b/crypto/key.go
@@ -45,28 +45,27 @@ type Key struct {
type plainKeyJSON struct {
Id []byte
Address []byte
- KeyHeader keyHeaderJSON
PrivateKey []byte
}
type encryptedKeyJSON struct {
- Id []byte
- Address []byte
- KeyHeader keyHeaderJSON
- Crypto cipherJSON
+ Id []byte
+ Address []byte
+ Crypto cipherJSON
}
type cipherJSON struct {
MAC []byte
Salt []byte
IV []byte
+ KeyHeader keyHeaderJSON
CipherText []byte
}
type keyHeaderJSON struct {
Version string
Kdf string
- KdfParams *scryptParamsJSON // TODO: make more generic?
+ KdfParams scryptParamsJSON // TODO: make more generic?
}
type scryptParamsJSON struct {
@@ -78,15 +77,9 @@ type scryptParamsJSON struct {
}
func (k *Key) MarshalJSON() (j []byte, err error) {
- keyHeader := keyHeaderJSON{
- Version: "1",
- Kdf: "",
- KdfParams: nil,
- }
jStruct := plainKeyJSON{
k.Id,
k.Address.Bytes(),
- keyHeader,
FromECDSA(k.PrivateKey),
}
j, err = json.Marshal(jStruct)