日期:2014-05-20  浏览次数:20826 次

x509 证书问题, WCF 客户端和服务器端通信, 能只在WCF 服务器端单方面认证吗? 不想给客户端设证书, 可以的话,config怎么设置...
x509 证书问题, WCF 客户端和服务器端通信, 能只在 WCF 服务器端单方面认证吗? 可以的话,config怎么设置...

现在WCF 程序,双方都设 证书, 通信成功, 如果假设,WCF 客户端很多.我不想认证客户端,只想,客户端认征 WCF 服务器端, 给 WCF 服务器设 证书, config 该怎么设置,,求救!!!! 

我尝试了几个方法,不成功,,求救!!!! 

现在的相关的 config如下:

服务器端..

<behaviors>
  <serviceBehaviors>
  <behavior name="WCF.Service1Behavior">
   
  <serviceCredentials>
   
  <clientCertificate>
  <authentication certificateValidationMode="ChainTrust"/>
  </clientCertificate>
   
  <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WCF.CustomUserNameValidator,WCF"/>
   
  <serviceCertificate findValue="MyServer" storeLocation="CurrentUser" x509FindType="FindBySubjectName"/>
   
  </serviceCredentials>
   
  <serviceMetadata httpGetEnabled="true"/>
  <serviceDebug includeExceptionDetailInFaults="true"/>
  </behavior>

客户端:
  <behaviors>
  <endpointBehaviors>
  <behavior name="NewBehavior">
  <clientCredentials>
  <clientCertificate findValue="Client1" x509FindType="FindBySubjectName" />
  <serviceCertificate>
  <authentication certificateValidationMode="None" />
  </serviceCertificate>
  </clientCredentials>
  </behavior>
  </endpointBehaviors>
  </behaviors>



------解决方案--------------------
不懂,帮顶。
------解决方案--------------------
不行
证书用来加密解密的,客户端证书里有公钥
------解决方案--------------------
我们的客户端配置如下:
<behaviors>
<endpointBehaviors>
<behavior name="ClientCertificateBehavior">
<clientCredentials>
<serviceCertificate> <authentication certificateValidationMode="None" />
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
这并不一定是你说想要的,看看这个
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2498938&SiteID=1
http://blogs.msdn.com/sajay/archive/2007/01/05/thoughts-on-basichttpbinding-security-and-ssl.aspx
------解决方案--------------------
不行

因为WCF会使用证书来给消息加密和签名,以保证其完整性,唯一性(不可被篡改)和安全性(其他人即使截获也看不懂)
所以只要你使用了WCF的Authoration,即使你用的是UserPassword方式的身份验证,WCF也会要求你必须使用证书
------解决方案--------------------
探讨

回楼上,我现在的.证书 .只是用来证明是不是真正的服务器端发过来的请求,证明这个服务器不是假的.而我不想应证客户端,难道这样不行吗???