Using a custom AlgorithmSuite with a WCF Service CustomBinding

Status
Niet open voor verdere reacties.

MrYagi

Nieuwe gebruiker
Lid geworden
6 feb 2018
Berichten
4
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.CreateMutualCertificateBindingElement(MessageSecurityVersion.WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10);
sec.DefaultAlgorithmSuite = new MyCustomAlgorithmSuite();
sec.SetKeyDerivation(false);
sec.MessageSecurityVersion = MessageSecurityVersion.WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10;
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);




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.CreateMutualCertificateBindingElement(MessageSecurityVersion.WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10);
sec.DefaultAlgorithmSuite = new MyCustomAlgorithmSuite();
sec.SetKeyDerivation(false);
sec.MessageSecurityVersion = MessageSecurityVersion.WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10;
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.c...SecurityPolicy.cs,132da28d1b354cf1,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?
 
Een nederlands forum waar ook Nederlands getypt wordt.
Engelse vraag mag je omzetten naar Nederlands.
Deze gaat op slot.
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan