[erlang-questions] exception error: bad argument in function crypto:ec_key_generate/2

Gabriele Santomaggio g.santomaggio@REDACTED
Sat Jul 23 18:29:06 CEST 2016


Hi,

Executing this code:

crypto:generate_key(ecdh, secp112r2).

on centos 6/7 I get this error:

1> crypto:generate_key(ecdh, secp112r2).
** exception error: bad argument
     in function  crypto:ec_key_generate/2
        called as crypto:ec_key_generate({{prime_field,

<<219,124,42,191,98,227,94,102,128,118,190,173,32,139>>},

{<<97,39,194,76,5,243,138,10,170,246,92,14,240,44>>,

<<81,222,241,129,93,181,237,116,252,195,76,133,215,9>>,

<<0,39,87,161,17,77,105,110,103,104,117,97,81,117,83,22,
                                             192,94,11,212>>},

<<4,75,163,10,181,232,146,180,225,100,157,208,146,134,67,

173,205,70,245,136,46,55,71,222,243,...>>,

<<54,223,10,175,216,184,215,89,124,161,5,32,208,75>>,
                                          <<4>>},
                                         undefined)
2>


The same code on Ubuntu works correctly:

4> crypto:generate_key(ecdh, secp112r2).
{<<4,80,204,3,54,107,208,108,63,20,107,12,38,106,212,97,
   102,31,150,82,196,11,163,51,255,158,213,19,...>>,
 <<44,243,165,184,148,43,124,19,234,144,220,206,39,234>>}
5>



Notes:
I tried with different Erlang VM from starting from 18.3.
I tried also to rebuild the last OPENSSL version on centos without success.


The code above is a semplication from my original problem that is the
follow:
Args={{prime_field,<<255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,0,0,0,0,0,0,0,0,
0,0,0,1>>},
{<<"ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿþ">>,
<<180,5,10,133,12,4,179,171,245,65,50,86,80,68,176,183,
215,191,216,186,39,11,57,67,35,85,255,180>>,
<<189,113,52,71,153,213,199,252,220,69,181,159,163,185,
171,143,106,148,139,197>>},
<<4,183,14,12,189,107,180,191,127,50,19,144,185,74,3,193,
211,86,194,17,34,52,50,128,214,17,92,29,33,189,55,99,
136,181,247,35,251,76,34,223,230,205,67,117,160,90,7,
71,100,68,213,129,153,133,0,126,52>>,
<<255,255,255,255,255,255,255,255,255,255,255,255,255,
255,22,162,224,184,240,62,19,221,41,69,92,92,42,61>>,
<<1>>}.

crypto:generate_key(ecdh, Args).

it works on ubuntu and not in Centos 6/7

Thank you!


GaS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160723/a290dcbf/attachment.htm>


More information about the erlang-questions mailing list