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

Storing and loading the private key #672

Closed
kroggen opened this issue Oct 11, 2019 · 3 comments
Closed

Storing and loading the private key #672

kroggen opened this issue Oct 11, 2019 · 3 comments

Comments

@kroggen
Copy link

kroggen commented Oct 11, 2019

Hi!

Congrats for the great software! It is way faster than OpenSSL.

I was not able to find how to store and load the private key. Preferably in a small binary format.

@kroggen
Copy link
Author

kroggen commented Oct 11, 2019

Analyzing the code I could notice that the private key is not stored on the context. I was used with mbed-crypto where it is the opposite.

So we are responsible for generating the private key with a strong RNG, checking if it is valid with the secp256k1_ec_seckey_verify function (or secp256k1_ec_privkey_verify when renamed), storing it and loading it.

A documentation on README would be helpful.

Cheers,

@real-or-random
Copy link
Contributor

Have you seen the header file?
https://github.com/bitcoin-core/secp256k1/blob/master/include/secp256k1.h

It has a good documentation but I admit there's no general section on usage of the library.

Related to #184 .

@nickfarrow
Copy link

For anyone else interested in how to generate keys using this library, feel free to checkout my Bitcoin vanity address generator which I think provides a short and reasonably well commented example of how to generate private and public key pairs.

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

3 participants