admin管理员组

文章数量:1434935

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);
    
 }

本文标签: cHow to sign specific parts of a wcf client soap messageStack Overflow