WCF-在soap消息体中为特定字段签名

WCF-在soap消息体中为特定字段签名,wcf,soap,sign,Wcf,Soap,Sign,我只需要在WCF消息中的一个特定字段上签名。 该类还有下一个方面: [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] [System.ServiceModel.MessageContractAttribute(WrapperName="simpleInputData",

我只需要在WCF消息中的一个特定字段上签名。 该类还有下一个方面:

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.MessageContractAttribute(WrapperName="simpleInputData",
    ProtectionLevel = ProtectionLevel.None
   , IsWrapped=true)]
public partial class SimpleOperationRequest
{

    [System.ServiceModel.MessageHeaderAttribute(
      ProtectionLevel = ProtectionLevel.None)]
    public BusinessHeader businessHeader;

    [System.ServiceModel.MessageHeaderAttribute(
        ProtectionLevel = ProtectionLevel.None)]
    public TechnicalHeader technicalHeader;

    [System.ServiceModel.MessageBodyMemberAttribute(
        ProtectionLevel = ProtectionLevel.Sign, Order = 0)]
    public SimpleInput simpleInput;

    [System.ServiceModel.MessageBodyMemberAttribute(
         ProtectionLevel = ProtectionLevel.None, Order = 1)]
    public Attachment attachment;

    [...]
}
正如您所看到的,我只需要签名simpleInput字段,但是,当我运行代码时,发送的包是(仅显示body节点):

[…]
莱加?
iVBORw0K…5CYII=
[...]
在代码中,您可以看到全身节点已签名

如何仅获取已签名的节点“simpleInput”


提前多谢

在WCF中不可能。你必须在整个身体上签名,否则什么都不能。您可以选择要签名的标题

[...]      
<s:Body u:Id="_3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <simpleInputData xmlns="http://xxxx/simple">
          <simpleInput>
            <in>llega?</in>
          </simpleInput>
          <attachment>
            <ImageData>iVBORw0K...5CYII=</ImageData>
          </attachment>
        </simpleInputData>
      </s:Body>
    [...]