Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to add a custom AlgorithmSuite to a WCF Service (SOAP) I host in IIS programmatically. For this I created my own ServiceHostFactory and my own CustomBinding() instance. However 1 thing I can't manage to do is apply my custom AlgorithmSuite, and I don't know the reason why I shouldn't be able to do that. I use the same CustomBinding (+ the same AlgorithmSuite) for a WCF client and it works fine.

Here is my complete CustomBinding:

var customBinding = new CustomBinding();
AsymmetricSecurityBindingElement sec = (AsymmetricSecurityBindingElement)AsymmetricSecurityBindingElement.CreateMutualCertificateBindingEle ment(MessageSecurityVersion.WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecuri tyProfile10);
sec.DefaultAlgorithmSuite = new MyCustomAlgorithmSuite();
sec.SetKeyDerivation(false);
sec.MessageSecurityVersion = MessageSecurityVersion.WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityPro file10;
sec.MessageProtectionOrder = MessageProtectionOrder.EncryptBeforeSign;
sec.EnableUnsecuredResponse = false;
sec.SecurityHeaderLayout = SecurityHeaderLayout.Lax;
sec.AllowSerializedSigningTokenOnReply = true;
TextMessageEncodingBindingElement enc = new TextMessageEncodingBindingElement(MessageVersion.Soap11, Encoding.UTF8);
HttpsTransportBindingElement trans = new HttpsTransportBindingElement();
trans.RequireClientCertificate = true;
customBinding.Elements.Add(sec);
customBinding.Elements.Add(enc);
customBinding.Elements.Add(trans);



What happens is that on runtime I get a ArgumentOutOfRangeException: parameter suite. Thrown by this method: https://referencesource.microsoft.co...cf1,references That assertion implies that I can ONLY use the AlgorithmSuites defined by Microsoft itself. Can I bypass this? Or is there another way to apply MyCustomAlgorithmSuite to the WCF service, if so how?

Reference Source[^]

What I have tried:

What happens is that on runtime I get a ArgumentOutOfRangeException: parameter suite. Thrown by this method: https://referencesource.microsoft.co...cf1,references That assertion implies that I can ONLY use the AlgorithmSuites defined by Microsoft itself. Can I bypass this? Or is there another way to apply MyCustomAlgorithmSuite to the WCF service, if so how? 


Reference Source[^]
Posted
Updated 30-Mar-18 23:06pm
v2
Comments
Member 12198863 31-Jul-20 8:53am    
Have you by chance solved this issue, please? I have the exact same problem. I have to accept requests made by Java based client and WCF just can't match the settings.
Thank you
Member 12965969 9-Nov-21 7:46am    
SAME PROBLEM TOO, MY WCF SVC SERVICE IS NOT ABLE TO RECEIVE EQUESTS WITH ANY CUSTOM SOAP SECURITY HEADER

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900