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

Amend NEP-2 #17

Merged
merged 2 commits into from
Nov 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions nep-2.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ To keep the size of the encrypted key down, no initialization vectors (IVs) are

#Derive a key from the passphrase using scrypt

#*Parameters: passphrase is the passphrase itself encoded in UTF-8 and normalized using Unicode Normalization Form C (NFC). salt is addresshash from the earlier step, n=16384, r=8, p=8, length=64
#*Parameters: passphrase is the passphrase itself encoded in UTF-8 and normalized using Unicode Normalization Form C (NFC). Salt is the addresshash from the earlier step, n=16384, r=8, p=8, length=64

#*Let's split the resulting 64 bytes in half, and call them derivedhalf1 and derivedhalf2.

Expand All @@ -81,17 +81,17 @@ To keep the size of the encrypted key down, no initialization vectors (IVs) are

The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:

*0x01 0x42 + flagbyte + salt + encryptedhalf1 + encryptedhalf2
*0x01 0x42 + flagbyte + addresshash + encryptedhalf1 + encryptedhalf2

===Decryption steps===

#Collect encrypted private key and passphrase from user.

#Derive derivedhalf1 and derivedhalf2 by passing the passphrase and addresshash into scrypt function.

#Decrypt encryptedhalf1 and encryptedhalf2 using AES256Decrypt, merge them to form the encrypted private key.
#Decrypt encryptedhalf1 and encryptedhalf2 using AES256Decrypt, merge the two parts and XOR the result with derivedhalf1 to form the plaintext private key.

#Convert that private key into a NEO address.
#Convert that plaintext private key into a NEO address.

#Hash the NEO address, and verify that addresshash from the encrypted private key record matches the hash. If not, report that the passphrase entry was incorrect.

Expand Down