This file contains 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
internal Stream TransformToOctetStream(object inputObject, Type inputType, XmlResolver resolver, string baseUri) | |
{ | |
... | |
CanonicalXml xml4 = new CanonicalXml((XmlDocument) output, resolver); | |
return new MemoryStream(xml4.GetBytes()); | |
} |
This file contains 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 crypto = require('xml-crypto') | |
, Dom = require('xmldom').DOMParser | |
, fs = require('fs') | |
var xml = fs.readFileSync('./windows_store_signature.xml', 'utf-8'); | |
var doc = new Dom({ignoreWhiteSpace: true}).parseFromString(xml); | |
xml = doc.firstChild.toString() | |
var signature = crypto.xpath(doc, "//*//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']")[0]; | |
var sig = new crypto.SignedXml(); | |
sig.keyInfoProvider = new crypto.FileKeyInfo("./windows_store_certificate.pem"); |
This file contains 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
-----BEGIN CERTIFICATE----- | |
MIIDyTCCArGgAwIBAgIQNP+YKvSo8IVArhlhpgc/xjANBgkqhkiG9w0BAQsFADCB | |
jjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xEDAOBgNVBAcMB1Jl | |
ZG1vbmQxHjAcBgNVBAoMFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEWMBQGA1UECwwN | |
V2luZG93cyBTdG9yZTEgMB4GA1UEAwwXV2luZG93cyBTdG9yZSBMaWNlbnNpbmcw | |
HhcNMTExMTE3MjMwNTAyWhcNMzYxMTEwMjMxMzQ0WjCBjjELMAkGA1UEBhMCVVMx | |
EzARBgNVBAgMCldhc2hpbmd0b24xEDAOBgNVBAcMB1JlZG1vbmQxHjAcBgNVBAoM | |
FU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEWMBQGA1UECwwNV2luZG93cyBTdG9yZTEg | |
MB4GA1UEAwwXV2luZG93cyBTdG9yZSBMaWNlbnNpbmcwggEiMA0GCSqGSIb3DQEB | |
AQUAA4IBDwAwggEKAoIBAQCcr4/vgqZFtzMqy3jO0XHjBUNx6j7ZTXEnNpLl2VSe |
This file contains 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
[x] @mentions, #refs, [links](), **formatting**, and <del>tags</del> supported | |
[x] list syntax required (any unordered or ordered list supported) |
This file contains 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): |
This file contains 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 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 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 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 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 {...} |