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

BitcoinExtKey encrypt with password implementation is missing #155

Closed
nopara73 opened this issue Apr 25, 2016 · 4 comments
Closed

BitcoinExtKey encrypt with password implementation is missing #155

nopara73 opened this issue Apr 25, 2016 · 4 comments

Comments

@nopara73
Copy link
Contributor

nopara73 commented Apr 25, 2016

One can easily from BitcoinExtKey a BitcoinSecret, but not the other way around.
Although I am not sure why, but I take it as the expected behaviour. In this case the need arises for encryption and decryption of BitcoinExtKey.

@NicolasDorier
Copy link
Collaborator

There is no standard for encrypting a BitcoinExtKey. If encryption with password is needed for an ExtKey then the best is to use BIP39 with the Mnemonic class.

@nopara73
Copy link
Contributor Author

That is a transparent box design: Designing the system in terms of how it will look from the inside.
Should I implement it into NBitcoin, or you would like to keep it this way and close the issue?

@nopara73
Copy link
Contributor Author

After playing with Mnemonic I think I understand what the design should be, please correct me if I'm wrong:
Mnemonic AND password gives us the ExtKey.
A user has to know the password and (if not lazy) the mnemonic.
But the mnemonic should be stored by the wallet, too in encrypted form, and this encryption happens with the password.
This way the user don't have to type the mnemonic every time it logs into its wallet, only if it loses the encrypted file, in order to recover its wallet.

If I am finally on the right track here, I see how it would be a bad idea to implement encryption directly to the BitcoinExtKey, what I recommended in my previous comment (however it will still cost a lot of developer time for others until they finally figure this out, if they don't start out with Mnemonic right away.)

Is the mnemonic encryption supported somehow by NBitoin? (Currently I am using this StringCipher: http://stackoverflow.com/a/10177020/2061103)

@NicolasDorier
Copy link
Collaborator

Correct, I explain the Mnemonic it very well in my book http://n.bitcoin.ninja/ takes a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants