WCF Service and Mutual Authentication

Hi,

This processes confuses me. With a WCF Service and Mutual Authentication it is said that on the client  there MUST be the service certificate and obviously client cert.  And on the web service server there MUST be the client cert and the service certificate as well.

What is the situation or under what situation, given the web service certificate is not installed on the client, would the client work and interact or consume the web service without any contract faults being thrown or anything indicating service authentication failed?

The web service has something like this:

<system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSSecurityBindings">
          <security mode="Transport">
            <transport clientCredentialType="Certificate" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="TestService">
          <serviceMetadata httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="True" />
          <serviceCredentials>
            <clientCertificate>
              <authentication certificateValidationMode="PeerOrChainTrust" />
            </clientCertificate>
            <serviceCertificate findValue="23423D2E2D1" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySerialNumber" />
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <services>
      <service behaviorConfiguration="TestService" name="TestService">
        <endpoint binding="wsHttpBinding" bindingConfiguration="WSSecurityBindings" name="AtEndPoint" bindingNamespace="TestWebService" contract="TestWebService.ITestService" />
        <endpoint address="mex" contract="IMetadataExchange" binding="wsHttpBinding" bindingConfiguration="WSSecurityBindings" />
      </service>
    </services>
  </system.serviceModel>

Open in new window


If I am able to access the web service with using my client certificate but yet I do not have the service certificate on my client machine then how is it doing mutual authentication?

Any information on this would be greatly appreciated so this is understood.

Thanks
LVL 1
davismAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
you have to understand pki and how it works.
I have my private key and your public key
you have your private key and my public key
I encrypt something to send to you with my private key and your public key you decrypt with my public key and your private key. the converse is also true.
a good walkthrough for a workgroup environment is available @
http://blogs.msdn.com/b/bradleycotier/archive/2011/12/14/mutual-authentication-with-a-iis-hosted-wcf-data-service-installed-in-a-workgroup-environment.aspx
0
davismAuthor Commented:
Hi David,

No, I think I understand how that works. :-) I even saw that link before yet I think there is a more simple explanation.

The more I think about this and all I believe it's this...if you have an SSL web site where you assigned a cert to the SSL and person, on a browser, accesses it. Or an application (not a browser) accesses it and successfully. That is one-way authentication.

Now, if you have a client the clients needs to provide their CA cert (or self-assigned if we want to entertain that). The client would have the provide the cert with the payload with the payload. The server service is going to check that in the trusted people store. If that cert is there then it's good. That is the two-way authentication. If the cert is NOT there then an exception is thrown to indicate the x.509 cert is not found.

The reference to the:
 <security mode="Transport">
      <transport clientCredentialType="Certificate" />
 </security>

Open in new window

Implies SSL and a client certificate is in the payload.

A call-back could have some justification but more often than not I believe that would be unnecessary and one cannot force a client to implement a call-back and convey the necessity. The only time I can think of the variation and necessity is of a call-back is if the SSL cert and the webservice cert are different. I do not see or believe that is routine and at least not from what I have seen.

In reality, there is really no need to provide the cert to the client. For the purposes of the public key they can get it themselves. All then would have to do is like in IE 11, go to the https site. When you see the padlock, click it, then go to the view certificate and install the certificate. If they want to export from MMC and the Certificate snap-in they can (or however else they choose to do it. )

Would you disagree with what I mentioned?  (Kinda trying convey my observations and thoughts.)
0
David Johnson, CD, MVPOwnerCommented:
(OPTIONAL)If the web app associated with this binding requires a Client Certificate for authentication then it would request the client to send the certificate. Here the IIS Sever would send the client the distinguished names of the list of TRUSTED ROOT CA it supports.
http://blogs.msdn.com/b/kaushal/archive/2013/08/03/ssl-handshake-and-https-bindings-on-iis.aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
davismAuthor Commented:
Yes, I also know that even though there is no presence of a call back when you do the nettrace and capture the ETL or if you do a network capture .cap file or what have you. When you look at it in Wireshark you will see the TLSV1 references with a Key Exchange and Encrypted handshake message.

So, I guess I don't understand your reference to "(OPTIONAL)" because the web service would use that

<security mode="Transport">
      <transport clientCredentialType="Certificate" />
 </security>

Open in new window



And the client would use the:

<clientCredentials>
            <clientCertificate findValue="2ce200cd33[bla...bla..]" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySerialNumber"/>
            <serviceCertificate>
              <authentication  certificateValidationMode="PeerOrChainTrust"/>
            </serviceCertificate>
          </clientCredentials>

Open in new window

That will pass the client certificate which has to be on the server.

That further supports what I was saying.
0
davismAuthor Commented:
Thanks for the response! Very much appreciated and helpful!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.