<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><pre class="">On 07/23/2016 09:29 AM, Gabriele Santomaggio wrote:
>><i class=""> Executing this code:
</i>>><i class=""> 
</i>>><i class=""> crypto:generate_key(ecdh, secp112r2).
</i>>><i class=""> 
</i>>><i class=""> on centos 6/7 I get this error:
</i>
>This is a shot in the dark, but does the list returned by
>crypto:ec_curves() contain secp112r2 on your CentOS machine?</pre><div class=""><br class=""></div><div class="">Hi,  </div><div class=""><br class=""></div><div class=""><div class="">6> crypto:ec_curves().</div><div class="">[secp112r1,secp112r2,secp128r1,secp128r2,secp160k1,</div><div class=""> secp160r1,secp160r2,secp192r1,secp192k1,secp224k1,secp224r1,</div><div class=""> secp256k1,secp256r1,secp384r1,secp521r1,prime192v1,</div><div class=""> prime192v2,prime192v3,prime239v1,prime239v2,prime239v3,</div></div><div class=""><br class=""></div><div class="">The main problem btw is a ssl connection to an LDPAs</div><div class="">if i execute openssl s_client -connect my server:636 in the same machine it works correctly. </div><div style="widows: 1; " class="">If I try using  <span style="color: rgb(51, 51, 51); widows: 1; background-color: rgb(245, 245, 245);" class="">{ok, Socket} = ssl:connect("</span>my server<span style="color: rgb(51, 51, 51); widows: 1; background-color: rgb(245, 245, 245);" class="">", 636, [], infinity). I get the </span><font color="#333333" class="">exception </font>exception error: bad argument</div><div class=""><br class=""></div><div style="widows: 1; " class=""><font color="#333333" class="">After a few debug I found that this is the problem:</font></div><div style="widows: 1; " class=""><font color="#333333" class=""><br class=""></font></div><div class="">Args={{prime_field,<<255,255,255,255,255,255,255,255,255,255,</div><div class=""><pre class="">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).</pre><div class=""><pre class="">* 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)</pre><div class=""><br class=""></div></div></div><div class="">I suppose that there is a general problem when I try to use crypto:generate_key(ecdh,…)</div><div class="">Tried it on Centos 6 and 7. Same errors </div><div class="">  </div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thank you.</div><div class=""><br class=""></div><div class="">GaS</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div>
</body></html>