diff options
author | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-05-24 09:42:10 +0800 |
---|---|---|
committer | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-06-24 12:03:23 +0800 |
commit | d23ec6c4194e7c0f70372db58d49ec222dc4e22c (patch) | |
tree | 7bc662eec5dd034873887088825761a94ce989af /crypto/key.go | |
parent | 22c7ce0162f2d14a7340e00e93697780c91d2087 (diff) | |
download | go-tangerine-d23ec6c4194e7c0f70372db58d49ec222dc4e22c.tar go-tangerine-d23ec6c4194e7c0f70372db58d49ec222dc4e22c.tar.gz go-tangerine-d23ec6c4194e7c0f70372db58d49ec222dc4e22c.tar.bz2 go-tangerine-d23ec6c4194e7c0f70372db58d49ec222dc4e22c.tar.lz go-tangerine-d23ec6c4194e7c0f70372db58d49ec222dc4e22c.tar.xz go-tangerine-d23ec6c4194e7c0f70372db58d49ec222dc4e22c.tar.zst go-tangerine-d23ec6c4194e7c0f70372db58d49ec222dc4e22c.zip |
Change keystore to version 3
* Change password protection crypto in keystore to version 3
* Update KeyStoreTests/basic_tests.json
* Add support for PBKDF2 with HMAC-SHA256
* Change MAC and encryption key to avoid unnecessary hashing
* Add tests for test vectors in new wiki page defining version 3
* Add tests for new keystore tests in ethereum/tests repo
* Move JSON loading util to common for use in both tests and
crypto packages
* Add backwards compatibility with key store version 1
Diffstat (limited to 'crypto/key.go')
-rw-r--r-- | crypto/key.go | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/crypto/key.go b/crypto/key.go index 0b76c43ff..4075afd83 100644 --- a/crypto/key.go +++ b/crypto/key.go @@ -35,7 +35,7 @@ import ( ) const ( - version = "1" + version = 3 ) type Key struct { @@ -51,10 +51,17 @@ type plainKeyJSON struct { Address string `json:"address"` PrivateKey string `json:"privatekey"` Id string `json:"id"` - Version string `json:"version"` + Version int `json:"version"` } -type encryptedKeyJSON struct { +type encryptedKeyJSONV3 struct { + Address string `json:"address"` + Crypto cryptoJSON + Id string `json:"id"` + Version int `json:"version"` +} + +type encryptedKeyJSONV1 struct { Address string `json:"address"` Crypto cryptoJSON Id string `json:"id"` @@ -62,13 +69,12 @@ type encryptedKeyJSON struct { } type cryptoJSON struct { - Cipher string `json:"cipher"` - CipherText string `json:"ciphertext"` - CipherParams cipherparamsJSON `json:"cipherparams"` - KDF string `json:"kdf"` - KDFParams scryptParamsJSON `json:"kdfparams"` - MAC string `json:"mac"` - Version string `json:"version"` + Cipher string `json:"cipher"` + CipherText string `json:"ciphertext"` + CipherParams cipherparamsJSON `json:"cipherparams"` + KDF string `json:"kdf"` + KDFParams map[string]interface{} `json:"kdfparams"` + MAC string `json:"mac"` } type cipherparamsJSON struct { |