Ami*_*irT 5 ssl https wcf certificate
有没有办法使用WCF SSL与NetTcpBinding,不需要在客户端计算机上安装客户端证书?(SSL V2,如果我没有记错的话).
我们希望服务器证书将在客户端的可信存储中进行身份验证,并通过服务器的公钥加密其消息,这意味着,只有服务器计算机将持有私钥证书.
我们在两边使用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>
Run Code Online (Sandbox Code Playgroud)
客户配置:
<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>
Run Code Online (Sandbox Code Playgroud)
即时添加我当前的服务器和客户端配置.另一个问题:
在身份验证级别,我们希望客户端验证服务器的证书(我认为服务器的公钥应该在trustedPeople存储中),这可能吗?
您是否建议我们使用传输安全或消息?
如果我们想通过NTLM验证客户端和服务器(clientCredentialType = Windows)除了服务器的cert身份验证之外还可以执行它还是只能应用其中一个?到目前为止,我们已经使用过NTLM身份验证.
现在我得到异常:"'net.tcp:// servername:8040/** ' 不支持请求的升级.这可能是由于绑定不匹配(例如客户端而不是服务器上启用了安全性) ".我理解这个错误发生,因为客户端使用Windows安全和服务器在om证书,但当我也将客户端安全性更改为证书时,我得到一个错误:"没有提供客户端证书".但我不想设置客户的证书,这是我主要问题的一部分.
我们读到我们可以使用服务器的证书认证这个标签:
<identity>
<certificate encodedValue="encoded certificate"/>
</identity>
Run Code Online (Sandbox Code Playgroud)但是,我认为当我们通过在客户端的商店(trustedPeople)中搜索服务器的公钥来执行证书的身份验证时,身份验证是通过编码证书完成的.这些信息真的如此吗?这个身份标签是否可以替代客户信任的商店中的公钥?
希望你能够以这种方式提供帮助,再次感谢.
小智 11
你正在使用netTcpBiding并且需要使用传输安全性,那么你有3个选项,第一个选项需要服务证书,第二个选项根本不需要证书,第三个选项需要服务证书和客户端证书.对于您的方案,您应该使用option1,它将通过它的证书对服务进行身份验证,并为邮件提供机密性和完整性.
C >>机密性
I >>完整性
A >>认证(客户端会发生)
1-选项一提供(C + I)客户端不会进行身份验证,在这种情况下,TCP SSL(不是HTPS SSL)将用于提供C和I,服务将是
<!--//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>
Run Code Online (Sandbox Code Playgroud)
还因为将使用TCP SSL,因此服务必须为客户端提供证书,因此您需要在服务器中安装证书并配置服务以使用此证书来证明其身份,您还需要安装根证书客户端计算机上的服务证书的权限证书(通常在LocalMachine /受信任的根证书颁发机构中),并且服务需要具有以下行为来指定服务的证书
<serviceBehaviors>
<behavior>
<serviceCredentials>
<serviceCertificate findValue="localhost"
x509FindType="FindByIssuerName" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
Run Code Online (Sandbox Code Playgroud)
2-选项二提供(A + [C + I]),当您通过protectionLevel元素配置时,C和I是可选的.客户端auth将是windows auth(通常会使用Windows Stream Security来实现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>
Run Code Online (Sandbox Code Playgroud)
3-选项3提供(A + C + I),C和I不是可选的,客户端身份验证将通过客户端证书(每个客户端必须有自己的证书),在这种情况下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>
Run Code Online (Sandbox Code Playgroud)
还因为将使用TCP SSL,因此服务必须为客户端提供证书,因此您需要在服务器中安装证书并配置服务以使用此证书来证明其身份,您还需要安装根证书客户端计算机上的服务证书的权限证书(通常在LocalMachine /受信任的根证书颁发机构中),并且服务需要具有以下行为来指定服务的证书
<serviceBehaviors>
<behavior>
<serviceCredentials>
<serviceCertificate findValue="localhost"
x509FindType="FindByIssuerName" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5057 次 |
最近记录: |