Hi Guys,
I am writing a wcf (TCPBinding) test program. I want to make it secured by using TSL.
My server side configuration code is like this:
NetTcpBinding tcpBinding = new NetTcpBinding();
tcpBinding.TransactionFlow = false;
tcpBinding.Security.Mode = SecurityMode.TransportWithMessageCredential;
tcpBinding.Security.Transport.ProtectionLevel = System.Net.Security.ProtectionLevel.EncryptAndSign;
tcpBinding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Certificate;
host.Credentials.ServiceCertificate.SetCertificate(
StoreLocation.LocalMachine,
StoreName.My, X509FindType.FindBySubjectName, "ServerCerSubject");
host.Credentials.ClientCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.PeerOrChainTrust;
and my client site configuration is like this:
oBinding = new NetTcpBinding();
((NetTcpBinding)oBinding).ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;
((NetTcpBinding)oBinding).Security.Mode = SecurityMode.TransportWithMessageCredential;
((NetTcpBinding)oBinding).Security.Transport.ClientCredentialType = TcpClientCredentialType.Certificate;
((NetTcpBinding)oBinding).Security.Transport.ProtectionLevel = System.Net.Security.ProtectionLevel.EncryptAndSign;
WCFServer=new ChannelFactory<WCFShared.ITCPServer>(oBinding, new EndpointAddress(UriString));
WCFServer.Credentials.ClientCertificate.SetCertificate(
StoreLocation.CurrentUser,
StoreName.My,
X509FindType.FindBySubjectName, "ClientCerSubject");
I have created the server and client certificate by Makecert.exe
The problem is the client is able to connect to the server even if it uses another certificate!! I mean if I change the client to use another certificate, it still works!
Can someone please tell me what is happening?
I expected that the client certificate should match with the server one that is used by my server application! but It seems that the client certificate is not important! the only thing I have noticed is, the Client needs server certificate to be exist in his trusted people.
Thanks.