Storing and loading the private key #672

issue kroggen opened this issue on October 11, 2019
  1. kroggen commented at 3:42 AM on October 11, 2019: none

    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.

  2. kroggen commented at 4:10 AM on October 11, 2019: none

    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,

  3. kroggen closed this on Oct 11, 2019

  4. real-or-random commented at 5:07 AM on October 11, 2019: 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 .

  5. nickfarrow commented at 11:46 PM on March 24, 2020: none

    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.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-20 06:52 UTC