WCF - Create Test Certificate

WCF - Create Test Certificate

Old forum URL: forums.lhotka.net/forums/t/5073.aspx


JoOfMetL posted on Wednesday, July 09, 2008

Hello,

I am not an expert in WCF and I had great difficulty to create a test certificate that I could share with my colleagues. Here is the solution I have used, perhaps it could be used for other than me.
The certificate works with CustomSecurity used by Csla.

I have create a bat files to create my Certificate :

ECHO Creating a Test Certificate

ECHO OFF

SET certificatName=MyCompanyTest
SET makecert="C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\makecert"
set pvk2pfx="C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\pvk2pfx"

%makecert% -r -pe -n "CN=%certificatName%" -b 01/01/2007 -e 01/01/2010 -sky exchange %certificatName%.cer -sv %certificatName%.pvk
%pvk2pfx% -pvk %certificatName%.pvk -spc %certificatName%.cer -pfx %certificatName%.pfx 

PAUSE


I didn't put any password, I have just click on Ok.

The command create some file.
Next,  install the file 'MyCompanyTest.pfx' and chosse the magazin TrustedPeople.

In my web.config files :

I have put :

<serviceCredentials>
            <serviceCertificate
            findValue="MyCompanyTest"
            storeLocation="CurrentUser"
            storeName="TrustedPeople"
            x509FindType="FindBySubjectName" />


In the app.config file on the client, i have used the Visual Studio Tools to create my app.config file. (Web Reference).

Your colleagues must install the pfx file, and they can work.

Copyright (c) Marimer LLC