From: Nokan Emiro Date: 2012-10-28T03:28:36+09:00 Subject: OpenSSL ECDSA public key from private --f46d04478aa19eaace04cd0e9a40 Content-Type: text/plain; charset=UTF-8 Hi, Could anybody please tell me how can I generate a public key from a private one with OpenSSL (or any other lib/gem) in Ruby? What I'm trying to do is something like this: irb(main):001:0> *require 'openssl'* => true irb(main):002:0> *key = OpenSSL::PKey::EC.new 'secp256k1'* => # irb(main):003:0> *key.private_key = .......* => ........ irb(main):004:0> *key.public_key?* => false irb(main):005:0> *key.public_key* => nil Setting the private_key works fine, but I need to calculate the public_key too. I'm sure there's a way to ask the key object to calculate the corresponding public key, I just don't know how. u. --f46d04478aa19eaace04cd0e9a40 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi,

Could anybody please tell me how can I generate a pu= blic key from
a private one with OpenSSL (or any other lib/gem) i= n Ruby? =C2=A0What I'm
trying to do is something like this:

irb(main):001:0= > require 'openssl'
=C2=A0 =3D> true

irb(main):002:0> key =3D OpenSSL::PKey::EC.new &= #39;secp256k1'
=C2=A0 =3D>= ; #<OpenSSL::PKey::EC:0x7f685ae68420>

irb(main):003:0= > key.private_key =3D .......
=C2=A0 =3D> ........
<= font class=3D"Apple-style-span" face=3D"'courier new', monospace" s= ize=3D"1">
irb(main):004:0> key.public_key?
=C2=A0 =3D> false

irb(main):005:0= > key.public_key
=C2=A0 =3D> nil


Setting the private_key works fine, but I = need to calculate the public_key too.
I'm sure there's a = way to ask the key object to calculate the corresponding
public k= ey, I just don't know how.

u.


--f46d04478aa19eaace04cd0e9a40--