I'm trying to understand the process of transport security authentication, based on certificates. Suppose I'm making a service with the following config with https opened on 8732 port:
<wsHttpBinding>
<binding name="SecurityTest">
<security mode="Transport">
<transport clientCredentialType="Certificate"/>
</security>
</binding>
</wsHttpBinding>
<service name="MyNamespace.MyService">
<host>
<baseAddresses>
<add baseAddress="https://localhost:8732/MyService/" />
</baseAddresses>
</host>
<endpoint
address=""
binding="wsHttpBinding" bindingConfiguration="SecurityTest"
contract="MyNamespace.IContract" >
</endpoint>
</service>
Then I create a self-signed certificate for Root Authority so that I could create new certificates:
makecert -n "CN=MyAuthority" -r -sv MyAuthority.pvk MyAuthority.cer -sky exchange
Then I add my MyAuthority.cer
to the local machine "Root" cataloge. After this I create another certificate using my MyAuthority certificate and place it in local machine's "My" catalog:
makecert -sky exchange -sk local -iv MyAuthority.pvk -n "CN=local" -ic MyAuthority.cer local.cer -sr Localmachine -ss My
Then I use netsh to bind my local.cer certificate to 8732 port:
netsh http add sslcert ipport=0.0.0.0:8732 certhash=02b751d7f71423c27141c9c385fc3d3976 d7 aa b5 appid={C4BFC5DC-2636-495B-9803-8DD8257C92C3}
The server service side is done, and it starts and works. Now I create a client:
<bindings>
<wsHttpBinding>
<binding name="SecurityTest" >
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint name="testPoint"
address="https://localhost:8732/MyService/"
binding="wsHttpBinding" bindingConfiguration="SecurityTest"
behaviorConfiguration="ep"
contract="MyNamespace.IContract">
</endpoint>
</client>
<behaviors>
<endpointBehaviors>
<behavior name="ep" >
<clientCredentials>
<clientCertificate findValue="local"
storeLocation="CurrentUser" storeName="My"
x509FindType="FindBySubjectName" />
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
When I start it and consume the service method, I get an error:
MessageSecurityException: The HTTP request was forbidden with client authentication scheme 'Anonymous'" when accessing credential secured WCF service from remote computer
I what to ask if I understand everything well in this scheme, and maybe to get advice, how to solve this error.
Does my service uses local.cer to encrypt messages on transport level?
Do I have to add
MyAuthority.cer
to Trusted published catalog on each client machine in order my clients could decrypt the messages without creating personal validation handlers?Does my client in current example uses the local.cer as his credentials, and this certificate would be send to the service side?
How does server side handles the client certificate? Does it check if it was signed by MyAuthority.cer or it checks it with the ssl certificate? How I can see what the certificate is checked with?
Why do I get the error?
Thanks in advance