Certificate with private key .Net Core

Viewed 3697

Anyone know how to create a X509Certificate2 with a private key in .net core, there is no property X509Certificate2.PrivateKey which I can set?

I have the following code

byte[] rawData = ....; var x509Certificate2 = new X509Certificate2(rawData.ToArray(), "XXXX"); bool hasPK = x509Certificate2.HasPrivateKey; // is false

How do I add my PK to the certificate above so that I can pass it into my IdentityServer 4 signing mechanism using services.AddIdentityServer().AddSigningCredential(x509Certificate2);

Any help on either topic is appreciated

1 Answers
Related