Search code examples
wcfc#-4.0wcf-securityx509certificatex509

How to make X.509 certificate?


I am trying to make a X.509 certificate. I am using makecert.exe to make this. I use this command to make my X.509 certificate

 makecert.exe -sr LocalMachine -ss My -a sha1 -n CN=MyServerCert -sky exchange –pe

But i don`t know there X.509 certificate is storeing.
I need to use this X.509 certificate in my c# code. The code is :

  host.Credentials.ServiceCertificate.Certificate = new X509Certificate2("MyServerCert.p12", "password");

But i don`t know what is password and it throw this exception "The system cannot find the file specified."


Solution

  • I always use the SelfCert tool from PluralSight. You can download it here. The same pages also give usage and code examples.

    Great free tool, can't do without it.