<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=DE link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'>Hi,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'>I’m trying to generate a public key out of a private one, but I get a bad argument exception.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'>Without passing in a private key everything works as expected:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'>5> {A, B} = crypto:generate_key(ecdh, x25519).<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'>{<<88,216,213,80,104,49,248,233,208,241,195,111,5,45,82,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'> 92,137,30,43,41,127,9,104,22,219,147,147,160,...>>,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'> <<248,251,237,26,106,194,122,49,49,147,162,189,80,223,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'> 224,216,21,126,161,1,101,38,43,21,161,98,92,...>>}<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'>But if I add a private key to the function:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'>6> crypto:generate_key(ecdh, x25519, B). <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'>** exception error: bad argument<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'> in function crypto:ec_key_generate/2<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'> called as crypto:ec_key_generate({evp,x25519},<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'> <<248,251,237,26,106,194,122,49,49,147,162,189,80,223,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'> 224,216,21,126,161,1,101,38,43,21,161,98,92,...>>)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'>Also being new to this I’m a bit confused with the output of:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'>7> crypto:info_lib().<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'>[{<<"OpenSSL">>,269488191,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'> <<"OpenSSL 1.1.1c 28 May 2019">>}]<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'>But my system openssl command reports a different version, but same date:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'>sh> openssl version<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'>OpenSSL 1.0.2s 28 May 2019<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'>Cheers,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt'>Bernard<o:p></o:p></span></p></div></body></html>