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条)