Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protected private key & Web3 Secret Storage Definition #614

Merged
merged 13 commits into from Oct 31, 2019

Conversation

@dahlia
Copy link
Member

dahlia commented Oct 24, 2019

This patch implements #577.

ProtectedPrivateKey protects a PrivateKey with a user input passphrase (i.e., password), and can be stored as a JSON data according to Ethereum's Web3 Secret Storage Definition (so-called “keystore”).

At the moment, it implements only minimum compliance according to the spec, pbkdf2 and aes-128-ctr:

PBKDF2 must be supported by all minimally-compliant implementations, denoted though:

  • kdf: pbkdf2

All minimally-compliant implementations must support the AES-128-CTR algorithm, denoted through:

  • cipher: aes-128-ctr
@dahlia dahlia added this to the 0.7.0 milestone Oct 24, 2019
@dahlia dahlia added this to In progress in 스프린트서울 201910 via automation Oct 24, 2019
@longfin longfin removed this from In progress in 스프린트서울 201910 Oct 26, 2019
@dahlia dahlia force-pushed the dahlia:protected-private-key branch from 9d5d39e to 7ae1f30 Oct 29, 2019
@codecov

This comment has been minimized.

Copy link

codecov bot commented Oct 29, 2019

Codecov Report

Merging #614 into master will decrease coverage by 2.65%.
The diff coverage is 56.05%.

@@            Coverage Diff             @@
##           master     #614      +/-   ##
==========================================
- Coverage   90.82%   88.17%   -2.66%     
==========================================
  Files         202      217      +15     
  Lines       15815    17152    +1337     
==========================================
+ Hits        14364    15123     +759     
- Misses       1146     1153       +7     
- Partials      305      876     +571
Impacted Files Coverage Δ
Libplanet/Crypto/PrivateKey.cs 86.2% <ø> (ø) ⬆️
Libplanet.Tests/KeyStore/Kdfs/KdfTest.cs 100% <100%> (ø)
Libplanet.Tests/TestUtils.cs 93.54% <100%> (+13.54%) ⬆️
Libplanet/KeyStore/KeyJsonException.cs 100% <100%> (ø)
Libplanet/KeyStore/InvalidKeyJsonException.cs 100% <100%> (ø)
Libplanet/KeyStore/IncorrectPassphraseException.cs 100% <100%> (ø)
Libplanet.Tests/Store/StoreTest.cs 99.06% <100%> (ø) ⬆️
Libplanet/ByteUtil.cs 88.23% <100%> (+0.35%) ⬆️
...t.Tests/KeyStore/MismatchedAddressExceptionTest.cs 100% <100%> (ø)
...Tests/KeyStore/IncorrectPassphraseExceptionTest.cs 100% <100%> (ø)
... and 27 more
@dahlia dahlia force-pushed the dahlia:protected-private-key branch 2 times, most recently from d944d7f to eed97be Oct 30, 2019
@dahlia dahlia changed the title WIP: Protected private key Protected private key & Web3 Secret Storage Definition Oct 30, 2019
@dahlia dahlia added this to In progress in 스프린트서울 201910 via automation Oct 30, 2019
@dahlia dahlia removed this from In progress in 스프린트서울 201910 Oct 30, 2019
@dahlia dahlia marked this pull request as ready for review Oct 30, 2019
@dahlia dahlia requested review from longfin, limebell, earlbread, moreal and planetarium/libplanet Oct 30, 2019
Libplanet/KeyStore/MismatchedAddressException.cs Outdated Show resolved Hide resolved
Libplanet/ByteUtil.cs Outdated Show resolved Hide resolved
CHANGES.md Show resolved Hide resolved
Libplanet.Tests/KeyStore/Ciphers/Aes128CtrTest.cs Outdated Show resolved Hide resolved
Libplanet/KeyStore/ProtectedPrivateKey.cs Outdated Show resolved Hide resolved
Libplanet/KeyStore/Kdfs/Pbkdf2.cs Outdated Show resolved Hide resolved
Libplanet.Tests/KeyStore/Kdfs/KdfTest.cs Outdated Show resolved Hide resolved
Libplanet/KeyStore/Ciphers/Aes128Ctr.cs Outdated Show resolved Hide resolved
Libplanet/KeyStore/ProtectedPrivateKey.cs Outdated Show resolved Hide resolved
Libplanet/KeyStore/ProtectedPrivateKey.cs Outdated Show resolved Hide resolved
dahlia added a commit to dahlia/libplanet that referenced this pull request Oct 31, 2019
dahlia added a commit to dahlia/libplanet that referenced this pull request Oct 31, 2019
It allocates only once if the source's length is known (i.e., the source
implements ICollection<T>).

planetarium#614 (comment)
dahlia added a commit to dahlia/libplanet that referenced this pull request Oct 31, 2019
@dahlia dahlia force-pushed the dahlia:protected-private-key branch from eed97be to 67c5050 Oct 31, 2019
@dahlia dahlia requested a review from earlbread Oct 31, 2019
Copy link
Member

earlbread left a comment

This needs to be rebased.

@dahlia dahlia dismissed stale reviews from earlbread and longfin via 512f3c7 Oct 31, 2019
@dahlia dahlia force-pushed the dahlia:protected-private-key branch from 67c5050 to 512f3c7 Oct 31, 2019
@dahlia dahlia requested review from longfin and earlbread Oct 31, 2019
@dahlia dahlia merged commit 7a719d7 into planetarium:master Oct 31, 2019
16 of 18 checks passed
16 of 18 checks passed
dist
Details
docs
Details
codecov/patch 56.05% of diff hit (target 90.82%)
Details
codecov/project 88.17% (-2.66%) compared to 157c95a
Details
WIP Ready for review
Details
changelog This contains self-describing changelog.
Details
license/cla Contributor License Agreement is signed.
Details
planetarium.libplanet Build #20191031.8 succeeded
Details
planetarium.libplanet (Linux_Mono) Linux_Mono succeeded
Details
planetarium.libplanet (Linux_NETCore) Linux_NETCore succeeded
Details
planetarium.libplanet (Windows_Mono) Windows_Mono succeeded
Details
planetarium.libplanet (Windows_NETCore) Windows_NETCore succeeded
Details
planetarium.libplanet (Windows_NETCore_Benchmark) Windows_NETCore_Benchmark succeeded
Details
planetarium.libplanet (Windows_NETCore_coverage) Windows_NETCore_coverage succeeded
Details
planetarium.libplanet (Windows_NETFramework) Windows_NETFramework succeeded
Details
planetarium.libplanet (macOS_Mono) macOS_Mono succeeded
Details
planetarium.libplanet (macOS_NETCore) macOS_NETCore succeeded
Details
planetarium.libplanet (macOS_Unity) macOS_Unity succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.