Hi all,
I have create a self-signed x.509 certificate using the makecert.exe
and pvkimprt.exe tools. Manually I was able to add the resulting
cert.pfx file using the MMC Certificate admin tools.
How can I programmatically add a self-signed x.509 certificate
(including a private key) to the certificate store?
Any help would be greatly appreciated.
Regards,
Diego
Rob Vretenar - 30 Nov 2004 20:20 GMT
The easiest way to do this programmatically is to use Microsoft's Web
Service Enhancements (WSE 2.0). The WSE contains several classes in
the Microsoft.Web.Services2.X509 namespace that can help you.
X509CertificateStore will allow you to open a cert store for writing.
X509CertificateCollection can represent all of the certs in that store.
X509Certificate is your certificate that you can load from file.
Once you have your cert, you can add it to the cert collection for the
given store.
You can download WSE2 from Microsoft's web site.
Hope that helps
Rob Vretenar [imason inc.]