I create a certificate using BouncyCastle
var keypairgen = new RsaKeyPairGenerator(); keypairgen.Init(new KeyGenerationParameters(new Secure
If you look at the links from this question, you should be able to use something similar to DotNetUtilities.ToRSA(...) and put its return value into the X509Certificate2's PrivateKey.
DotNetUtilities.ToRSA(...)
X509Certificate2
PrivateKey