Ought secp256k1_ec_privkey_import() also indicate whether the key is compressed? #246

issue afk11 openend this issue on April 30, 2015
  1. afk11 commented at 4:35 pm on April 30, 2015: contributor

    When exporting a private key, the compressed flag is required to create the correct DER key.

    I noticed that secp256k1_ec_privkey_import() only takes a pointer for a secret key. I think it should take an int * to inform whether the key should be serialized to its compressed representation.

    I’ll try have a look see if it’s a straightforward change, though my C isn’t the best. Does this seem worthwhile, or was there perhaps a reason it doesn’t do this?

  2. sipa commented at 4:41 pm on April 30, 2015: contributor

    The DER private key import/export are only really intended for compatibility reasons, and they should probably have big comments explaining the limitations.

    What you are saying is not necessary for its use in Bitcoin, but I wouldn’t be opposed to having it, if others find it useful.

  3. afk11 commented at 4:49 pm on April 30, 2015: contributor

    I see - I haven’t looked much at it’s use in Bitcoin Core. I ask because without it, other implementations using the library must track state elsewhere. I anticipate the usage might be importing the DER key and immediately doing secp256k1_ec_pubkey_create(..., seckey, compressed).

    Oops - tapped my touchpad and closed this by mistake

  4. afk11 closed this on Apr 30, 2015

  5. afk11 reopened this on Apr 30, 2015

  6. afk11 closed this on Nov 2, 2016


afk11 sipa


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: 2024-11-24 00:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me