This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ReplacePrefixMessageEncodingBindingElement : MessageEncodingBindingElement | |
| { | |
| MessageEncodingBindingElement inner; | |
| Dictionary<string, string> namespaceToPrefixMapping = new Dictionary<string, string>(); | |
| public ReplacePrefixMessageEncodingBindingElement(MessageEncodingBindingElement inner) | |
| { | |
| this.inner = inner; | |
| } | |
| private ReplacePrefixMessageEncodingBindingElement(ReplacePrefixMessageEncodingBindingElement other) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| X509SecurityTokenParameters x509Params = new X509SecurityTokenParameters(); | |
| x509Params.X509ReferenceStyle = | |
| X509KeyIdentifierClauseType.SubjectKeyIdentifier; | |
| x509Params.RequireDerivedKeys = false; | |
| ; | |
| x509Params.InclusionMode = SecurityTokenInclusionMode.Never; | |
| x509Params.ReferenceStyle = SecurityTokenReferenceStyle.Internal; | |
| x509Params.X509ReferenceStyle = X509KeyIdentifierClauseType.Any; | |
| ((AsymmetricSecurityBindingElement) sec).InitiatorTokenParameters = x509Params; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void SignXmlFile(string FileName, string SignedFileName, RSA Key) | |
| { | |
| // Create a new XML document. | |
| XmlDocument doc = new XmlDocument(); | |
| // Load the passed XML file using its name. | |
| doc.Load(new XmlTextReader(FileName)); | |
| // Create a SignedXml object. | |
| SignedXml signedXml = new SignedXml(doc); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var b = new CustomBinding(); | |
| var sec = (AsymmetricSecurityBindingElement)SecurityBindingElement.CreateMutualCertificateBindingElement(MessageSecurityVersion.WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10); | |
| sec.EndpointSupportingTokenParameters.Signed.Add(new UserNameSecurityTokenParameters()); | |
| sec.MessageSecurityVersion =MessageSecurityVersion. | |
| WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10; | |
| sec.IncludeTimestamp = true; | |
| sec.MessageProtectionOrder = System.ServiceModel.Security.MessageProtectionOrder.SignBeforeEncrypt; | |
| sec.EnableUnsecuredResponse = true; | |
| b.Elements.Add(sec); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Net.Security; | |
| [ServiceContract(..., ProtectionLevel=ProtectionLevel.Sign)] | |
| public interface ServicePortType {...} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var b = new CustomBinding(); | |
| var sec = (AsymmetricSecurityBindingElement)SecurityBindingElement.CreateMutualCertificateBindingElement(MessageSecurityVersion.WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10); | |
| sec.EndpointSupportingTokenParameters.Signed.Add(new UserNameSecurityTokenParameters()); | |
| sec.MessageSecurityVersion = | |
| MessageSecurityVersion. | |
| WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10; | |
| sec.IncludeTimestamp = false; | |
| sec.MessageProtectionOrder = System.ServiceModel.Security.MessageProtectionOrder.EncryptBeforeSign; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #rabitmq is already installed in ubuntu | |
| #start/stop/status | |
| $> sudo rabbitmqctl status | |
| OR | |
| $> sudo invoke-rc.d rabbitmq-server status | |
| #enable mgmt console | |
| $> /usr/lib/rabbitmq/lib/rabbitmq_server-2.7.1/sbin/rabbitmq-plugins enable rabbitmq_management |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace ConsoleApplication309 | |
| { | |
| public class B : IEndpointBehavior | |
| { | |
| #region IEndpointBehavior Members | |
| public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) | |
| { | |
| MessagePartSpecification m = new MessagePartSpecification(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //see full information and possible error messages here: | |
| http://webservices20.blogspot.co.il/2012/06/12-common-wcf-interop-confusions.html | |
| //This is the most common WCF security setting for interoperability | |
| <customBinding> | |
| <binding name="NewBinding0"> | |
| <textMessageEncoding messageVersion="Soap11" /> | |
| <security authenticationMode="MutualCertificate" includeTimestamp="false" | |
| messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"> | |
| <secureConversationBootstrap /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //decrypt the encryptedKey to get the session key: | |
| //================================================== | |
| string wrappingKey = "put here the value base64 CipherValue under the encryptedKey element"; | |
| X509Certificate2 serverCert = new X509Certificate2(File.ReadAllBytes(@"c:\temp\xws-security-server.p12"), "changeit"); | |
| RSACryptoServiceProvider rsa = (RSACryptoServiceProvider)serverCert.PrivateKey; | |
| var enckey = rsa.Decrypt(Convert.FromBase64String(wrappingKey), true); | |
| return enckey; | |
| //decrypt the soap body using the session key (aes128): |