title: Add Private Key to X509Certificate
body: <p>I'm working on some code that currently uses OpenSSL.net to create a public/private key pair for a Certificate Signing Request. The request is equipped with the public key and sent to a CA which returns a signed certificate. Then the previously created private key is added to the certificate:</p>
  
  <pre><code>myCert.PrivateKey = CryptoKey.FromPrivateKey(rsa.PrivateKeyAsPEM, null);
  </code></pre>
  
  <p>The problem is I need a .net X509Certificate because the rest of the software uses SslStream and other .net classes for TLS. </p>
  
  <p>I was able to create a certificate from the CA's response, but I did not find a way to add the private key to it. I also tried creating an OpenSSL certificate from the CA's response, exporting that as DER or PEM and creating the .net certificate from that, but it always ignores the private key. </p>
  
  <p>Any ideas on how I could solve this problem?</p>