Great! Say, I want to extract the public key and make it available to another 
entity or module? Possibly DER-encoded, though I'd like to learn how to do 
both: extract  ASN.1-encoded and raw (assuming it is possible). 

Thanks!

Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G LTE network.
  Original Message  
From: Viktor Dukhovni
Sent: Thursday, March 17, 2016 17:57
To: openssl-users@openssl.org
Reply To: openssl-users@openssl.org
Subject: Re: [openssl-users] Naive: how to generate EC public key from EC       
private key?


> On Mar 17, 2016, at 5:17 PM, Blumenthal, Uri - 0553 - MITLL <u...@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.

-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

Attachment: smime.p7s
Description: S/MIME cryptographic signature

-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

Reply via email to