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

Any advice on how to encrypt the private key with a passphrase? #55

Open
eddiejibson opened this issue Mar 27, 2020 · 1 comment
Open
Labels

Comments

@eddiejibson
Copy link

Hi,

I'm building an application that requires a private key to be encrypted/decrypted with a passphrase. As this is not currently a feature, what advice would you give me regarding how I should go about this? Planning on obviously pushing any changes I make privately to enhance this.

Thanks

@JBaczuk
Copy link
Contributor

JBaczuk commented Jun 17, 2020

I would not recommend doing this as a passphrase is a weak key for encryption. Theoretically, you would take the passphrase and hash it into 32 bytes using something like sha256. Then you have to check and hope that it is a valid private key on the secp256k1 curve using isValidPrivateKey.

I would recommend looking at BIP39 Seed Phrases, that way it's not human generated, but still human readable.

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

No branches or pull requests

2 participants