Partager via


Automate Creating certificates for WCF

Creating certificates for Wcf Testing

open visual studio 2008 command prompt and run as administrator.

makecert.exe -sr LocalMachine -ss MY -pe -sky exchange -n "CN=WcfClientCert" WcfClientCert.cer

cert2spc WcfClientCert.cer WcfClientCert.spcpvkimprt -pfx WcfClientCert.spc WcfClientCert.pvk

The command (pvkimprt -pfx) creates the file using a Gui ,name it as WcfClientCert.pfx. This PFX file can then be imported into the Windows certificate store and used for code signing.(makecert.exe and cert2spc.exe are part of several Microsoft SDKs, e.g. the Platform SDK or the DotNet SDKs, which can be downloaded from microsoft.com).
--if the Pfx file is already available use the command below to install into a certificate store and give permissions to aspnet worker process, for  win 2003 or 2008 use NetworkService instead of Aspnet in the line below

winhttpcertcfg.exe -i WcfClientCert.pfx -c LOCAL_MACHINE\My -a ASPNET  --the command below is to copy the certficate public key to the trustedpeople store in the localmachine, generally the wcf service needs the client's public key in its trusted store.certmgr.exe -add -r localmachine -s My -c -n WcfClientCert -r localmachine -s TrustedPeople

Comments

  • Anonymous
    May 25, 2010
    we can use pvk2pfx instead of pvkimprt to avoid the GUI and get complete automation