c# - How to sign specific parts of a wcf client soap message? - Stack Overflow

I have to communicate with a soap service that requires me to sign specific parts of the message. I can

I have to communicate with a soap service that requires me to sign specific parts of the message. I can configure this in soapUI, as in image below. I need to sign the WSA headers from and to, the timestamp and the body.

I cannot seem to find the correct place to configure this. I get most of the way it seems with the code below. But where in the custombinding do I specify the correct parts to sign?


 WSHttpBinding binding = new WSHttpBinding();
 binding.Security = new WSHttpSecurity()
 {
     Mode = SecurityMode.Transport,
     Transport = new HttpTransportSecurity()
     {
         ClientCredentialType = HttpClientCredentialType.Certificate,
     }
 };

 CustomBinding customBinding = new CustomBinding(binding);

 UpdateBinding(customBinding);
 private static void UpdateBinding(CustomBinding binding)
 {
    

     var sec = SecurityBindingElement.CreateCertificateOverTransportBindingElement();
     sec.DefaultAlgorithmSuite = SecurityAlgorithmSuite.Basic128Sha256;
     sec.IncludeTimestamp = true;

     binding.Elements.Insert(0, sec);
    
 }

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745623712a4636675.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信