简体   繁体   English

WCF消息安全性是否实际加密了消息内容?

[英]Does WCF message security actually encrypt message contents?

I have read the documentation provided at MSDN, and some other posts on this site. 我已阅读MSDN上提供的文档以及本网站上的其他一些帖子。 However, its still a bit unclear whether WCF (specifically, NetTcpBinding) will actually encrypt message contents when using message security w/ certificates. 但是,当使用带有证书的消息安全性时,WCF(特别是NetTcpBinding)是否会实际加密消息内容仍然有点不清楚。 Does anyone know for sure? 有人有确切消息么?

For instance you can specify both transport and message credentials in your config: 例如,您可以在配置中指定传输和消息凭据:

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

As far as I can tell the MSDN documentation implies that message security simply relies on either username/password or certificate-based authentication (negotiation), but doesn't specifically state that the message themselves are actually encrypted at the message level. 据我所知,MSDN文档暗示消息安全性仅依赖于用户名/密码或基于证书的身份验证(协商),但没有具体说明消息本身实际上是在消息级别加密的。

For instance if I use ONLY message security, with certificate-based negotiation, I don't think message contents are actually encrypted (ie. a packet sniffer could intercept the raw message contents -- even if the service enforces authentication)? 例如,如果我只使用消息安全性,基于证书的协商,我不认为消息内容实际上是加密的(即,数据包嗅探器可以拦截原始消息内容 - 即使服务强制执行身份验证)?

If true message-level encryption is possible (using NetTcpBinding) how is it done in code? 如果可以进行真正的消息级加密(使用NetTcpBinding),如何在代码中完成? I believe this is related to the AlgorithmSuite, though I'm not sure, 我相信这与AlgorithmSuite有关,虽然我不确定,

binding.Security.Mode = SecurityMode.Message;
binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
binding.Security.Message.AlgorithmSuite = new System.ServiceModel.Security.TripleDesSecurityAlgorithmSuite(); 

Not sure if this fully answers your question, but according to this article TCP encrypts by default. 不确定这是否完全回答了你的问题,但根据这篇文章 TCP默认加密。

NetTcpBinding is secure by default. 默认情况下,NetTcpBinding是安全的。 Specifically, callers must provide Windows credentials for authentication and all message packets are signed and encrypted over TCP protocol. 具体而言,调用者必须提供Windows凭据进行身份验证,并且所有消息数据包都通过TCP协议进行签名和加密

In other words, if you customise the configuration but use a security mode other than 'None', 换句话说,如果您自定义配置但使用“无”以外的安全模式,

By default, all secure WCF bindings will encrypt and sign messages. 默认情况下,所有安全WCF绑定都将对消息进行加密和签名。 You cannot disable this for transport security, however, for message security you may wish to disable this for debugging purposes, or when an alternate method of protection is used such as IPSec. 您无法为传输安全性禁用此功能,但是,对于邮件安全性,您可能希望禁用此功能以进行调试,或者使用其他保护方法(如IPSec)时。

WCF can encrypt message contents with a netTcpBinding. WCF可以使用netTcpBinding加密消息内容。 The easiest way to see this is to add diagnostics to your .config file and output an svclog file. 最简单的方法是在.config文件中添加诊断程序并输出svclog文件。 You can actually see the encrypted message with the svctraceviewer.exe tool 您实际上可以使用svctraceviewer.exe工具查看加密的消息

Here's some more info (which you may have already read) WCF NetTcpBinding Security - how does it work? 这里有一些更多信息(您可能已经阅读过) WCF NetTcpBinding安全性 - 它是如何工作的?

Maybe a late answer. 也许是迟到的答案。 But here is something i stumbled upon on MSDN. 但这是我在MSDN上偶然发现的事情。

Message security makes the message secure regardless of what transport you use to transmit the message, and the security context is directly embedded inside the message. 无论您使用什么传输来传输消息,消息安全性都会使消息安全,并且安全上下文直接嵌入到消息中。

MSDN Article MSDN文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM