Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WCF消息安全性是否确实加密消息内容?_C#_Wcf_Security_Certificate_Nettcpbinding - Fatal编程技术网

C# WCF消息安全性是否确实加密消息内容?

C# WCF消息安全性是否确实加密消息内容?,c#,wcf,security,certificate,nettcpbinding,C#,Wcf,Security,Certificate,Nettcpbinding,我已经阅读了MSDN上提供的文档,以及本网站上的一些其他帖子。然而,当使用消息安全性w/证书时,WCF(具体地说,NetTcpBinding)是否真的会加密消息内容仍然有点不清楚。有人确切知道吗 例如,您可以在配置中同时指定传输凭据和消息凭据: <security mode="TransportWithMessageCredential"> <transport clientCredentialType="Certificate"/>

我已经阅读了MSDN上提供的文档,以及本网站上的一些其他帖子。然而,当使用消息安全性w/证书时,WCF(具体地说,NetTcpBinding)是否真的会加密消息内容仍然有点不清楚。有人确切知道吗

例如,您可以在配置中同时指定传输凭据和消息凭据:

       <security mode="TransportWithMessageCredential">
          <transport clientCredentialType="Certificate"/>
          <message clientCredentialType="Certificate"
                   negotiateServiceCredential="true" />
       </security>

WCF可以使用netTcpBinding加密消息内容。查看这一点的最简单方法是添加到.config文件并输出一个svclog文件。您可以使用svctraceviewer.exe工具实际查看加密消息


这里有一些更多的信息(您可能已经阅读过)

不确定这是否完全回答了您的问题,但根据TCP默认加密

默认情况下,NetTcpBinding是安全的。具体而言,呼叫者必须提供 验证的Windows凭据和所有消息包都是 通过TCP协议进行签名和加密

换句话说,如果您自定义配置,但使用“无”以外的安全模式

默认情况下,所有安全WCF绑定都将对消息进行加密和签名。 您不能为传输安全禁用此选项,但是,为邮件禁用此选项 安全性您可能希望出于调试目的禁用此功能,或者 使用另一种保护方法,如IPSec


也许是迟来的答复。但我在MSDN上偶然发现了一些东西

消息安全性使消息安全,无论您使用何种传输方式来传输消息,并且安全上下文直接嵌入到消息中


我决定自己用Wireshark嗅探数据包,我可以确认这是真的。显然,windows自己负责域/受信任域通信的加密。谢谢
binding.Security.Mode = SecurityMode.Message;
binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
binding.Security.Message.AlgorithmSuite = new System.ServiceModel.Security.TripleDesSecurityAlgorithmSuite();