2012-06-03 44 views
5

有没有什么办法可以在NetTcpBinding中使用WCF SSL,而不需要在客户端计算机上安装客户端证书? (如果我没有弄错,请使用SSL V2)。在没有客户端证书的情况下通过Tcp使用Wcf SSl证书(仅服务器端)

我们希望服务器证书将在客户端的可信存储中进行身份验证 并通过服务器的公钥对其消息进行加密,这意味着只有服务器计算机将持有私钥证书。

我们在两侧都使用NetTcpBinding而不是customBinding。 如果它可以完成,它的正确配置是什么? (在客户端&服务器配置)

在此先感谢。


这是我的wcf配置。

服务器配置:



    <configuration> 
     <system.serviceModel> 
     <bindings> 
     <netTcpBinding> 
      <binding name="TcpSecureBinding"> 
      <security mode="Transport"> 
       <transport clientCredentialType="Certificate"/>    
      </security> 
     </binding> 
     </netTcpBinding> 
     </bindings> 
     <behaviors> 
     <serviceBehaviors> 
      <behavior name="ServiceCredentialsBehavior">   
      <serviceDebug includeExceptionDetailInFaults="True" /> 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceAuthorization 
       principalPermissionMode="UseWindowsGroups"> 
      </serviceAuthorization> 
      <serviceCredentials> 
       <windowsAuthentication includeWindowsGruops="true"    
             allowAnonymousLogons="false"/> 
       <clientCertificate> 
        <authentication certificateValidationMode="none"/> 
       </clientCertificate> 
       <serverCertificate 
        findValue="thumbprint" 
        storelocation="LocalMachine" 
        x509FindType="FindMyThumbprint" 
        storeName="My"/> 
      </serviceCredentials> 
     </behavior> 
     </serviceBehaviors> 
     </behaviors> 
    <services> 
     <service behaviorConfiguration="ServiceCredentialsBehavior" 
       name="ServiceModel.Calculator"> 
      <endpoint address="net.tcp://localhost:8040/Calculator" 
        binding="netTcpBinding" 
        bindingConfiguration="TcpSecureBinding" 
        contract="ServiceModel.ICalculator" > 
      <identity> 
       <dns value="localhost"/> 
      </identity> 
     </endpoint> 
     </service> 
    </services> 
    </system.serviceModel> 
    </configuration> 

客户端配置:



    <configuration> 
     <system.serviceModel> 
     <client> 
     <endpoint address="net.tcp://localhost:8040/Calculator" 
       behaviorConfiguration="endpointCredentialBehavior" 
       binding="netTcpBinding" 
       bindingConfiguration="Binding1" 
       contract="ServiceModel.ICalculator"> 
      <identity> 
       <dns value="localhost"/> 
      </identity> 
      </endpoint> 
     </client> 
     <behaviors> 
     <endpointBehaviors> 
      <behavior name="endpointCredentialBehavior"> 
      </behavior> 
     </endpointBehaviors> 
     </behaviors> 
     <bindings> 
     <netTcpBinding> 
      <binding name="Binding1"> 
      <security mode="Transport"> 
       <transport clientCredentialType="Windows" /> 
      </security> 
      </binding> 
      </netTcpBinding> 
     </bindings> 
    </system.serviceModel> 
    </configuration> 

IM加入我当前的服务器&客户CONFIGS。 另一个问题:

  1. 在身份验证级别,我们希望客户端进行身份验证疗法服务器的证书 (我想服务器的公钥应该在trustedPeople店),这可能吗?

  2. 您是否建议使用传输安全或邮件?

  3. 如果我们想通过NTLM(clientCredentialType =的Windows)来验证客户端&服务器 是它除了可以完成服务器的证书认证或只可应用于其中之一吗?到目前为止,我们已经使用NTLM身份验证。

  4. 现在即时得到异常: “的请求的升级不支持‘的net.tcp://服务器名称:8040/**’。这可能是由于不匹配的绑定(例如启用安全性上客户端而不是服务器上)。“ 我明白这个错误发生,因为客户端使用Windows安全和服务器在om证书, ,但当im更改客户端安全证书也,即时获取错误: “未提供客户端证书”。但我不想设置客户端证书,这是我主要问题的一部分。

  5. 我们看到,我们可以使用服务器证书验证此标签:

    
        <identity> 
         <certificate encodedValue="encoded certificate"/> 
        </identity> 
    

但是,我认为这验证通过身份由一个编码的证书时,我们preffer完成了证书的鉴定将通过在客户端存储中搜索服务器的公钥(trustedPeople)来执行。这些信息真的是真的吗?这种身份的这个标签替代搜索客户端“S值得信赖的商店公钥?

希望你能够帮助这个方式,再次 感谢。

+0

这是可能的。你试过什么了? – Bernard

+0

除非您特别要求提供客户证书,否则您不需要客户证书;你的绑定配置是什么样的? –

+0

有人可以帮我解决我们的问题吗? – AmirT

回答

11

它使用的是netTcpBiding需要用Transport security然后你有3个选项,第一个选项需要服务证书,第二个选项不需要任何证书,第三个选项需要服务证书和客户端证书,你应该使用option1来验证服务的证书,将保证邮件的机密性和完整性。

C >>保密
I >>完整性
A >>认证(这将发生在客户端)

1-选项提供一个(C + I)无身份验证会发生在客户端,在这种情况下,TCP SSL(不在HTPS SSL)将被用于提供C和我,以及该服务将

<!--//Below are the configuration for both the service and the client--> 
<netTcpBinding> 
    <binding name="TcpSecureBinding"> 
     <security mode="Transport"> 
     <transport clientCredentialType="None"></transport> 
     </security> 
    </binding> 
    </netTcpBinding> 

也因为TCP将使用SSL那么该服务必须提供客户端证书,所以你需要在服务器中安装证书并配置服务以使用此证书来证明其身份,还需要为服务器安装根证书颁发机构证书在客户端计算机(通常在LOCALMACHINE /受信任的根证书颁发机构)上的副证书和服务需要有以下特性,以指定的证书的服务

<serviceBehaviors> 
    <behavior> 
     <serviceCredentials> 
     <serviceCertificate findValue="localhost" 
          x509FindType="FindByIssuerName" /> 
     </serviceCredentials> 
    </behavior> 
    </serviceBehaviors> 

2-选项2提供(A + [C + I]),在通过protectionLevel元素进行配置时,C和I是可选的。在客户端验证将是Windows验证(通常会使用Windows流安全,实现A,C和I)

<!--//Below are the configuration for both the service and the client--> 
<netTcpBinding> 
    <binding name="TcpSecureBinding"> 
     <security mode="Transport"> 
     <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"></transport> 
     </security> 
    </binding> 
    </netTcpBinding> 

3-选项3提供(A + C + I),C和我不可选和客户端的认证将通过客户端证书(每个客户必须有自己的证书), 在这种情况下,TCP SSL(不是HTPS SSL)将被用于提供A,C和I.

<!--//Below are the configuration for both the service and the client--> 
<binding name="TcpSecureBinding"> 
     <security mode="Transport"> 
     <transport clientCredentialType="Certificate"></transport> 
     </security> 
    </binding> 

也是因为将使用TCP SSL,那么服务必须为客户端提供证书,因此您需要在服务器中安装证书并配置要使用的服务此证书以证明其身份,还需要在客户端计算机(通常位于LocalMachine /受信任的根证书颁发机构)中安装服务证书的根证书颁发机构证书,并且该服务需要具有以下行为来指定证书为服务

<serviceBehaviors> 
    <behavior> 
     <serviceCredentials> 
     <serviceCertificate findValue="localhost" 
          x509FindType="FindByIssuerName" /> 
     </serviceCredentials> 
    </behavior> 
    </serviceBehaviors> 
+0

客户端端点配置需要看起来像只使用公共根CA密钥?我一直在尝试使用由根CA签署的机器证书来配置我的服务,但是当我将客户机配置为使用根CA时,客户机和服务器无法通话。但是,当我把服务机器的证书的公钥放在客户机上(并且把“findValue”改成那个证书的名称),它就可以工作。我究竟做错了什么? –

+0

[Ryan Gunn的博客](https://talkdotnet.wordpress.com/tag/nettcp/)的回答 – noobob

相关问题