简体   繁体   English

WCF中SOAP消息的数字签名

[英]Digital Signature for SOAP message in WCF

I have a WCF service in 4.0. 我在4.0中有一个WCF服务。

I need to add digital signature to the SOAP response.I am not quite sure how it actually should be done. 我需要在SOAP响应中添加数字签名。我不太确定它应该如何实现。 I believe the Response should look like what is shown in the link below. 我相信响应应该看起来像下面链接中显示的内容。

https://spaces.internet2.edu/display/ISWG/Signed+SOAP+Messages https://spaces.internet2.edu/display/ISWG/Signed+SOAP+Messages

Is there any place where i can get details about this? 有什么地方可以获得有关此的详细信息吗? Please advice. 请指教。

A message contract can indicate whether the headers and/or body of the message should be digitally signed and encrypted. 消息合同可以指示消息的标题和/或正文是否应该进行数字签名和加密。

This is done by setting the System.ServiceModel.MessageContractMemberAttribute.ProtectionLevel property on the MessageHeaderAttribute and MessageBodyMemberAttribute attributes. 这是通过在MessageHeaderAttribute和MessageBodyMemberAttribute属性上设置System.ServiceModel.MessageContractMemberAttribute.ProtectionLevel属性来完成的。 The property is an enumeration of the System.Net.Security.ProtectionLevel type and can be set to None (no encryption or signature), Sign (digital signature only), or EncryptAndSign (both encryption and a digital signature). 该属性是System.Net.Security.ProtectionLevel类型的枚举,可以设置为None(无加密或签名),Sign(仅限数字签名)或EncryptAndSign(加密和数字签名)。 The default is EncryptAndSign. 默认值为EncryptAndSign。

For these security features to work, you must properly configure the binding and behaviors. 要使这些安全功能起作用,您必须正确配置绑定和行为。 If you use these security features without the proper configuration (for example, attempting to sign a message without supplying your credentials), an exception is thrown at validation time. 如果在没有正确配置的情况下使用这些安全功能(例如,尝试在不提供凭据的情况下签署消息),则会在验证时抛出异常。

For message headers, the protection level is determined individually for each header. 对于邮件标题,将为每个标题单独确定保护级别。

For message body parts, the protection level can be thought of as the "minimum protection level." 对于消息正文部分,保护级别可以被认为是“最低保护级别”。 The body has only one protection level, regardless of the number of body parts. 无论身体部位的数量如何,身体只有一个保护等级。 The protection level of the body is determined by the highest ProtectionLevel property setting of all the body parts. 身体的保护级别由所有身体部位的最高ProtectionLevel属性设置决定。 However, you should set the protection level of each body part to the actual minimum protection level required. 但是,您应该将每个身体部位的保护级别设置为所需的实际最低保护级别。 Please see this article for more detailed examples. 有关更多详细示例,请参阅文章。

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

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