<div dir="ltr">I'm attempting to generate CSRs and certificates using the public_key library. I've run into trouble when using elliptic curves instead of RSA and the problem shows up even in the erl_make_certs.erl code included in the public_key tests.<div><br></div><div>Things work fine with RSA:</div><div><br></div><div>> erl_make_certs:make_cert([{key, rsa}]).<br></div><div>{<<48,130,2,136,48,130,1,241,160,3,2,1,2,2,6,0,220,55,12,</div><div>   84,65,48,13,6,9,42,134,72,...>>,</div><div> {'RSAPrivateKey',<<48,130,2,92,2,1,0,2,129,129,0,136,253,</div><div>                    122,221,72,60,185,68,243,119,187,161,</div><div>                    131,7,...>>,</div><div>                  not_encrypted}}</div><div><br></div><div>But fail with EC:</div><div><br></div><div><div>> erl_make_certs:make_cert([{key, ec}]).</div><div>** exception error: no match of right hand side value {error,{asn1,badarg}}</div><div>     in function  public_key:der_encode/2 (public_key.erl, line 253)</div><div>     in call from public_key:pkix_sign/2 (public_key.erl, line 529)</div><div>     in call from erl_make_certs:make_cert/1</div></div><div><br></div><div>The error is caused by the call to make_tbs/2. As far as I can tell, the problem is in the attempt to der_encode/2 the subject. The exact problem appears to be in encoding subject AttributeTypeAndValue with values of the form {printableString, Value}. What I can't determine is why this encoding succeeds for RSA but fails for EC.</div><div><br></div><div>Can anyone shed any light?</div><div><br></div><div><br></div><div>b</div><div><br></div></div>