Skip to content

Commit

Permalink
EIP-2333: Key derivation (#1104)
Browse files Browse the repository at this point in the history
* Add test to understand flow of key storage

* First commit

* Committing to save trait stuff

* Working naive design

* Add keystore struct

* Move keystore files into their own module

* Add serde (de)serialize_with magic

* Add keystore test

* Fix tests

* Add comments and minor fixes

* Pass optional params to `to_keystore` function

* Add `path` field to keystore

* Add function to read Keystore from file

* Add test vectors and fix Version serialization

* Checksum params is empty object

* Add public key to Keystore

* Add function for saving keystore into file

* Deleted account_manager main.rs

* Move keystore module to validator_client

* Add save_keystore method to validator_directory

* Add load_keystore function. Minor refactorings

* Fixed dependencies

* Address some review comments

* Add Password newtype; derive Zeroize

* Fix test

* Move keystore into own crate

* Remove padding

* Add error enum, zeroize more things

* Fix comment

* Add keystore builder

* Remove keystore stuff from val client

* Add more tests, comments

* Add more comments, test vectors

* Progress on improving JSON validation

* More JSON verification

* Start moving JSON into own mod

* Remove old code

* Add more tests, reader/writers

* Tidy

* Move keystore into own file

* Move more logic into keystore file

* Tidy

* Tidy

* Allow for odd-character hex

* Add more json missing field checks

* Use scrypt by default

* Tidy, address comments

* Test path and uuid in vectors

* Fix comment

* Add checks for kdf params

* Enforce empty kdf message

* Expose json_keystore mod

* Split out encrypt/decrypt

* Replace some password usage with slice

* Expose PlainText struct

* First commits on path derivation

* Progress with implementation

* More progress

* Passing intermediate test vectors

* Tidy, add comments

* Add DerivedKey structs

* Move key derivation into own crate

* Add zeroize structs

* Return error for empty seed

* Add tests

* Tidy

* Expose consts, remove Password

* Expose SALT_SIZE

* Move dbg assert statement

* Ensure bigints are zeroized

* Try fix Cargo.toml

Co-authored-by: pawan <pawandhananjay@gmail.com>
  • Loading branch information
paulhauner and pawanjay176 authored May 11, 2020
1 parent f30271e commit 5530bb1
Show file tree
Hide file tree
Showing 10 changed files with 1,132 additions and 0 deletions.
49 changes: 49 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ members = [
"eth2/utils/eth2_interop_keypairs",
"eth2/utils/eth2_keystore",
"eth2/utils/eth2_testnet_config",
"eth2/utils/eth2_keystore",
"eth2/utils/eth2_key_derivation",
"eth2/utils/logging",
"eth2/utils/eth2_hashing",
"eth2/utils/hashmap_delay",
Expand Down
15 changes: 15 additions & 0 deletions eth2/utils/eth2_key_derivation/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "eth2_key_derivation"
version = "0.1.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rust-crypto = "0.2.36"
zeroize = { version = "1.0.0", features = ["zeroize_derive"] }
num-bigint-dig = { version = "0.6.0", features = ["zeroize"] }

[dev-dependencies]
hex = "0.3"
Loading

0 comments on commit 5530bb1

Please sign in to comment.