WCF服务不加密响应

时间:2013-11-04 00:37:06

标签: wcf encryption wcf-binding wcf-security wcf-encryption

我们在IIS中托管了一个WCF服务,其中包含以下 customBinding 。该服务接收来自IBM Datapower的加密和签名请求。该服务可以验证签名并解密请求。 但发出的响应未加密或签名。(我可以使用WCF日志记录验证)

<customBinding>
    <binding name="myCustomBinding">
      <textMessageEncoding messageVersion="Soap11" />
      <httpsTransport requireClientCertificate="false" realm="" />
    </binding>
</customBinding>

<behaviors>
  <serviceBehaviors>
    <behavior name="myServiceBehavior">
      <serviceCredentials>
        <serviceCertificate findValue="{serverCertificateName}" x509FindType="FindBySubjectName" 
                            storeLocation ="LocalMachine" storeName ="My"/>
        <clientCertificate>
          <certificate findValue="{clientCertificateName}" x509FindType="FindBySubjectName"
                        storeLocation ="LocalMachine" storeName ="My" />
          <authentication certificateValidationMode="None" includeWindowsGroups="false"/>
        </clientCertificate>
      </serviceCredentials>
    </behavior>
 </serviceBehaviors></behaviors>

MessageContracts将ProtectionLevel设置为ProtectionLevel.EncryptAndSign

我在这里错过了什么吗?

1 个答案:

答案 0 :(得分:0)

我不是WCF专家,请原谅我,如果我问下面的问题。

要加密和签署[在PKI域中]内容,您需要拥有一个私钥[并且每个人都知道证书中没有包含]。所以我很好奇,关于在上面的配置中指定私钥的位置。如果您在上面的配置中指定证书,会自动选择相应的私钥[我只是好奇,因为我不确定引擎盖下是什么]?

相反,当您收到加密内容时,您唯一需要验证和解密的是证书[实际上在大多数情况下,保留可能发生的关键协商]。

请告诉我这是否有帮助?可能这个评论太微不足道了[如果是这样的话,请原谅我。]