title: Certificate with private key .Net Core
body: <p>Anyone know how to create a <code>X509Certificate2</code> with a private key in .net core, there is no property <code>X509Certificate2.PrivateKey</code> which I can set?</p>
  
  <p>I have the following code</p>
  
  <p><code>byte[] rawData = ....;
  var x509Certificate2 = new X509Certificate2(rawData.ToArray(), "XXXX");
  bool hasPK = x509Certificate2.HasPrivateKey; // is false
  </code></p>
  
  <p>How do I add my PK to the certificate above so that I can pass it into my IdentityServer 4 signing mechanism using <code>services.AddIdentityServer().AddSigningCredential(x509Certificate2);</code></p>
  
  <p>Any help on either topic is appreciated</p>