[openssl-users] Naive: how to generate EC public key from EC private key?
Viktor Dukhovni
openssl-users at dukhovni.org
Thu Mar 17 21:57:03 UTC 2016
> On Mar 17, 2016, at 5:17 PM, Blumenthal, Uri - 0553 - MITLL <uri at ll.mit.edu> wrote:
>
> I’ve an extremely naïve question. I am generating ephemeral EC keys for ECDH, following the example in https://wiki.openssl.org/index.php/EVP_Key_and_Parameter_Generation
>
> But it looks like the example ends on generation of the private key:
> /* Generate the key */
> if (!EVP_PKEY_keygen(kctx, &key)) goto err;
>
>
> The next step must be obvious, but somehow I can’t figure it out. So my question is: from having EVP_PKEY *privateECKey how do I get EVP_PKEY *publicECKey?
The public key is always there. You either have both the public and private keys
or just the public key. So the same EVP_PKEY object holds both. What you do
next depends on what you want to do with the public key...
--
Viktor.
More information about the openssl-users
mailing list