0

我有安全模式设置为消息的 WCF 服务:

<security mode="Message">
   <message 
      clientCredentialType="UserName" 
      negotiateServiceCredential="true" 
      establishSecurityContext="true" 
      algorithmSuite="Default" />
</security>
...
<behaviors>
  <serviceBehaviors>
      ...
      <serviceCredentials>
        <serviceCertificate findValue="my Certifiacate ..."/>
      </serviceCredentials>

服务证书在 serviceBehaviors 部分给出。

当 VS 创建客户端 (.NET)(通过添加服务引用)时,它会<identity><certificate encodedValue="long string"/></identity>在 web.config 中创建元素。

我发现即使此部分为空白,客户端也可以成功连接服务。我的猜测是客户端使用服务证书的编码值来加密消息。但是,当配置中未指定编码值时,它也可以工作吗?那么这样做的目的是什么?

4

1 回答 1

0

仅当您在 wcf 配置中指定要在绑定中使用加密时,它才会加密。

<wsHttpBinding>
  <binding>
    <security mode="Message">
      <transport clientCredentialType="Windows" proxyCredentialType="None"
       realm="" />
      <message clientCredentialType="Certificate" negotiateServiceCredential="true"
       algorithmSuite="TripleDesSha256Rsa15" establishSecurityContext="true" />
     </security>
   </binding>
</wsHttpBindings>
于 2012-07-25T06:42:16.240 回答