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).
I know that I have the classes X509Certificate
and X509Certificate2
available to load certificates and get access to their information, but I don't see any classes or functionality within the System.Security.Cryptography
namespace that could be used to create a certificate request or to sign such a certificate request to create a new signed certificate.
And that although the documentation on the System.Security.Cryptography.Pkcs
namespace says:
The System.Security.Cryptography.Pkcs namespace provides programming elements for Public Key Cryptography Standards (PKCS), including methods for signing data, exchanging keys, requesting certificates, public key encryption and decryption, and other security functions.
So, how can I create a certificate request and fulfill that request to create a new X509 certificate using only pure .net classes from System.Security.Cryptography
?
Note:
- I don't want to use an external executable like openssl or MakeCert
- I don't want to use BouncyCastle
- I don't want to use Windows Certificate Enrollment API
- I don't want to use the native Win32 API functions