如何在自定义绑定中加密消息之前进行压缩?

时间:2012-10-24 15:47:20

标签: wcf encryption compression wshttpbinding custom-binding

我已经在microsoft http://msdn.microsoft.com/en-us/library/ms751458.aspx上关注创建用于压缩消息的自定义绑定的示例。但是,我希望同时加密流量。这很好用,但加密是在压缩之前执行的,这意味着消息的大小变大而不是更小... 我的绑定配置为

<customBinding>
  <binding name="GZipBinding" >                 
    <gzipMessageEncoding innerMessageEncoding="textMessageEncoding"/>
    <transactionFlow />
    <security authenticationMode="SecureConversation" >
      <secureConversationBootstrap authenticationMode="UserNameForCertificate" />
    </security>                 
    <httpTransport  maxReceivedMessageSize="104857600" maxBufferSize="104857600"/>
  </binding>
</customBinding>

在加密消息之前,是否有可能以某种方式进行压缩?

1 个答案:

答案 0 :(得分:0)

不要这样做。压缩加密流中的数据会导致安全漏洞。如果攻击者可以影响正在加密的消息的内容,他们可以使用重复数据的压缩来读取加密文件的内容。您最近可以看到SSL中出现的此类攻击here的详细信息。

相关问题