gocryptographyelliptic-curvekey-generator

Is there a preferred function for generating a private/public key-pair for an elliptic curve?


Is one of the following two functions preferred over the other? Do they both do the same thing, just with a different implementation?

Both seem to return the same values, just in a different package.

I want to create a private/public key-pair for the following curve

Thanks in advance! :)


Solution

  • In elliptic curve cryptography the private key is simply a large random number in some range, usually 0 - 2^256, the range is defined by curve itself though, usually the order of some cyclic subgroup, or the entire curve order when dealing with prime order curves.

    ECC is used for many things, Elliptic Curve Diffie Hellman, Elliptic Curve Signature (ECDSA) they all require scalar multiplication of a given private key by the curve's generator point to establish the public key.

    These scalar multiplication functions are implemented differently for various security and efficiency reasons.

    In short are three types of multiplication function:

    ECDSA uses fixed-base, ECDH uses variable-base.

    There is intuition here, during ECDH you must multiply your private key by someone else's "variable" public point.

    Anyway, to use Brainpool, you must generate a key suitable for that curves order, and multiply it by the curves generator point. Usually most API's allow specification of the curve.

    By the way, don't use Brainpool, it sucks.