Thanks Carlo, but it's not what I was looking for.  I know about
#generate_key.
It creates a random private key and calculates the corresponding public key
too.  But I already have a (non-random) private key.  (I mean it is an input
for my script.)

Now what I need is to set my own private key, and calculate the public key
that matches my already existing private key.  I have a private key which is
not a random number.  Well, maybe it was some time ago in another software,
but for now, I can read it from a file, and I have no problem setting that
data as a private key.  The problem is that I need the public key that
matches the private one.

So what I need is to ask the 'key' object to be so kind and calculate the
the
public key for me using my private key I've just set with #private_key=.

key.private_key =   *<a paramether from outside>*
*
*
key.plese_calculate_the_public_key_from_the_private_one!


u.



On Sat, Oct 27, 2012 at 8:37 PM, Carlo E. Prelz <fluido / fluido.as> wrote:

>         Subject: OpenSSL ECDSA public key from private
>         Date: Sun 28 Oct 12 03:28:36AM +0900
>
> Quoting Nokan Emiro (uzleepito / gmail.com):
>
> > 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.
>
> I have never done this myself before , but I was curious, and gave it
> a look.
>
> Your OpenSSL::PKey::EC instance has a method called
> #generate_key. After I run
>
> key.generate_key
>
> I find that key.private_key is populated with an instance of
> OpenSSL::BN, and key.public_key is populated with an instance of
> OpenSSL::PKey::EC::Point.
>
> I hope this is what you were looking for.
>
> Carlo
>
> --
>   *         Se la Strada e la sua Virtu' non fossero state messe da parte,
> * K * Carlo E. Prelz - fluido / fluido.as             che bisogno ci sarebbe
>   *               di parlare tanto di amore e di rettitudine? (Chuang-Tzu)
>
>