[erlang-questions] crypto ECDSA private key -> public

Ingela Andin ingela.andin@REDACTED
Tue Oct 28 11:25:02 CET 2014


Hi!

2014-10-28 10:48 GMT+01:00 Andreas Schultz <aschultz@REDACTED>:

> Hi,
>
> ----- On 27 Oct, 2014, at 23:24, semmit mondo semmitmondo@REDACTED
> wrote:
>
> > Yes and no.
> > According to the source of the crypto module generate_key/3
> > does accept a private key only for a few encryption method types.
> > This is the only function head that matches ecdh:
> > generate_key(ecdh, Curve, undefined) -> ...
> > There's no definition for ecdh with a 3rd param that is not
> > undefined. ...and generate_key/2 calls the above one:
> > generate_key(Type, Params) ->
> > generate_key(Type, Params, undefined).
> > It would be the function I'm after...
>
> The function you are looking for is ec_key_new in
> lib/crypto/c_src/crypto.c. That
> function is not exported to the Erlang world (originally it was in some
> faschion,
> but the crypto API restructuring un-exported it).
>
>

Humm that was a very big refactor and it sounds like we might have missed
an aspect.
The function should probably be made available through generate_key/3.


Regards Ingela Erlang/OTP Team - Ericsson AB




> Andreas
>
> >
> > Ingela Andin <ingela.andin@REDACTED> írta:
> >
> >
> > Hi!
> > There is also a function crypto:generate_key/3 that takes a private key
> as third
> > argument, maybe that is what you want?
> > Regards Ingela Erlang/OTP team - Ericsson AB
> > 2014-10-21 17:00 GMT+02:00 semmit mondo < semmitmondo@REDACTED > :
> >
> >
> > Hi,
> > How can I generate an ECDSA public key from the private one using crypto?
> > All I can do with it is to generate a public and private key pair at
> once:
> > {Pub, Priv} = crypto:generate_key(ecdh, prime239v3).
> > but can't calculate the public key if the private key was known
> beforehand.
> > (prime239v3 isn't important, it could be any EC curve...)
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
>
> --
> --
> Dipl. Inform.
> Andreas Schultz
>
> email: as@REDACTED
> phone: +49-391-819099-224
> mobil: +49-170-2226073
>
> ------------------- enabling your networks -------------------
>
> Travelping GmbH               phone:         +49-391-819099229
> Roentgenstr. 13               fax:           +49-391-819099299
> D-39108 Magdeburg             email:       info@REDACTED
> GERMANY                       web:   http://www.travelping.com
>
> Company Registration: Amtsgericht Stendal Reg No.:   HRB 10578
> Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780
> --------------------------------------------------------------
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20141028/19c01514/attachment.htm>


More information about the erlang-questions mailing list