title: Create a RSA* private key from {n, e, d}?
body: <p>I'm struggling with generating a RSA private key using given params e,n,d. </p>
  
  <pre><code>m_pKey = EVP_PKEY_new();
  RSA* rsa = RSA_new();
  
  rsa-&gt;e = e;
  rsa-&gt;n = n;
  rsa-&gt;d = d;
  
  
  EVP_PKEY_assign_RSA(m_pKey, rsa);
  </code></pre>
  
  <p>this works well for public key generation - I can easily create a .pem file, check it with command line and verify it's correct. However, a private key .pem file seems to lack some additional params. </p>
  
  <pre><code>sudo openssl rsa -noout -text -inform PEM -in priv_test.pem 
  unable to load Private Key
  139753508435600:error:0D078079:asn1 encoding routines:ASN1_ITEM_EX_D2I:field missing:tasn_dec.c:519:Field=p, Type=RSA
  139753508435600:error:04093004:rsa routines:OLD_RSA_PRIV_DECODE:RSA lib:rsa_ameth.c:115:
  139753508435600:error:0606F091:digital envelope routines:EVP_PKCS82PKEY:private key decode error:evp_pkey.c:95:
  139753508435600:error:0907B00D:PEM routines:PEM_READ_BIO_PRIVATEKEY:ASN1 lib:pem_pkey.c:132:
  </code></pre>