security - WCF X509 getting "Could not establish trust relationship for the SSL/TLS secure channel with authority" -


i'm developing wcf web service in c#, , test client go it. web service hosted in iis on server , test client running on desktop pc. able make calls web service client using http, trying working https , x509 certificates. when try make calls now, "could not establish trust relationship ssl/tls secure channel authority '192.168.5.5'". here i've done far try setup:

created self-signed certificate , key use certificate root:

makecert -n "cn=roottest" -r -sv roottest.pvk roottest.cer 

created certificates/keys signed above root server , client:

makecert -iv roottest.pvk -n "cn=servertest" -ic roottest.cer -sky exchange -pe -sv servertest.pvk servertest.cer makecert -iv roottest.pvk -n "cn=clienttest" -ic roottest.cer -sky exchange -pe -sv clienttest.pvk clienttest.cer 

imported roottest.cer "trusted root" under "local computer" on both server , client pc using mmc.

created pfx files server , client certificate/keys:

pvk2pfx.exe -pvk servertest.pvk -pi "mypassword" -spc servertest.cer -pfx servertest.pfx -po "mypassword" pvk2pfx.exe -pvk clienttest.pvk -pi "mypassword" -spc clienttest.cer -pfx clienttest.pfx -po "mypassword" 

imported servertest.pfx on server under "local computer", "personal" using mmc.

imported clienttest.pfx on client pc under "local computer", "personal" using mmc.

referenced "servertest" certificate in web.config on server:

  <system.servicemodel> <services>   <service name="mytestservice.service" behaviorconfiguration="mytestservicebehavior">     <endpoint address=""               binding="basichttpbinding"               bindingconfiguration="securebasichttpbinding"               contract="mytestservice.service.iservicecontract" />     <endpoint address="mex" binding="mexhttpbinding" contract="imetadataexchange"/>   </service> </services> <behaviors>   <servicebehaviors>       <behavior name="mytestservicebehavior" >         <servicemetadata httpgetenabled="true" />         <servicedebug includeexceptiondetailinfaults="true" />         <servicecredentials>           <servicecertificate storelocation="localmachine" storename="my" findvalue="cn=servertest" />         </servicecredentials>       </behavior>   </servicebehaviors> </behaviors> <bindings>    <basichttpbinding>       <binding name="securebasichttpbinding">          <security mode="transportwithmessagecredential">             <message clientcredentialtype="certificate" />          </security>       </binding>    </basichttpbinding> </bindings> 

referenced "clienttest" certificate in app.config on pc client:

  <system.servicemodel> <client>   <endpoint address="https://192.168.5.5/mytestservice/service.svc"             behaviorconfiguration="mytestclientbehavior"             binding="basichttpbinding"             bindingconfiguration="securebasichttpbinding"             contract="mytestservice.service.iservicecontract" /> </client> <behaviors>   <endpointbehaviors>     <behavior name="mytestclientbehavior" >       <clientcredentials>         <clientcertificate storelocation="localmachine" storename="my" findvalue="cn=clienttest" />         <servicecertificate>           <authentication revocationmode="nocheck" />         </servicecertificate>        </clientcredentials>     </behavior>   </endpointbehaviors> </behaviors> <bindings>   <basichttpbinding>     <binding name="securebasichttpbinding">       <security mode="transportwithmessagecredential">         <message clientcredentialtype="certificate" />       </security>     </binding>   </basichttpbinding> </bindings> 

what doing wrong or missing? in advance replies.

from client system, use browser (for example ie) navigate endpoint wcf service hosted. browser should tell certificate not trusted , why. enter image description here

then click 'continue website' , view certificate clicking 'certificate error' in navigation bar , click 'view certificates' link. enter image description here

the certificate view should tell why certificate not trusted.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -