title: Generate and Sign Certificate Request using pure .net Framework
body: <p>I am trying to use pure .net code to create a certificate request and create a certificate from the certificate request against an existing CA certificate I have available (either in the Windows Certificate store or as a separate file).</p>
  <p>I know that I have the classes <code>X509Certificate</code> and <code>X509Certificate2</code> available to load certificates and get access to their information, but I don't see any classes or functionality within the <code> System.Security.Cryptography</code> namespace that could be used to create a certificate request or to sign such a certificate request to create a new signed certificate.</p>
  <p>And that although the <a href="https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.pkcs" rel="noreferrer">documentation on the <code>System.Security.Cryptography.Pkcs</code> namespace</a> says:</p>
  <blockquote>
  <p>The System.Security.Cryptography.Pkcs namespace provides programming
  elements for Public Key Cryptography Standards (PKCS), including
  methods for signing data, exchanging keys, <strong>requesting certificates</strong>,
  public key encryption and decryption, and other security functions.</p>
  </blockquote>
  <p>So, how can I create a certificate request and fulfill that request to create a new X509 certificate using only pure .net classes from <code>System.Security.Cryptography</code>?</p>
  <hr />
  <p>Note:</p>
  <ul>
  <li>I don't want to use an external executable like openssl or MakeCert</li>
  <li>I don't want to use BouncyCastle</li>
  <li>I don't want to use Windows <a href="https://docs.microsoft.com/en-us/windows/win32/seccertenroll/certenroll-portal" rel="noreferrer">Certificate Enrollment API</a></li>
  <li>I don't want to use the native Win32 API functions</li>
  </ul>