I need to generate a CSR from a computer using Portable.BouncyCastle library in C#. Once the CSR is created I need to store the CSR PrivateKey in the Certificate store to protect it.
Creating CSR using Pkcs10CertificationRequest is fine.
Pkcs10CertificationRequest csr = new Pkcs10CertificationRequest("SHA1WITHRSA", subject, keyPair.Public, null, keyPair.Private);
StringBuilder CSRPem = new StringBuilder();
PemWriter CSRPemWriter = new PemWriter(new StringWriter(CSRPem));
CSRPemWriter.WriteObject(csr);
CSRPemWriter.Writer.Flush();
But now, how to store the PrivateKey securely on the computer that has generated the CSR (Windows computer) so that it is persistent and use for later on decryption?
Thanks a lot for your help!