0

SOAP is not one of my friends, so let me please kindly ask for some help.

I have a request to create a SOAP messages to send data to external service. It have to be authentificated and signed by certificate.

Bellow is show how it should look like - this is a part of the header - "Security".

Let me please ask - what are all those hashes and were can I get them? (they are "highlighted" with ** ** in code)

Many thanks for any reply, much appreciated.

Kind regards

<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
   <wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-536E4AA6BF962CA97613699845428011">**MIIE+TCCA+GgAwIBAgIKPs365QAAAAAASjANBgkqhkiG9w0BAQUFADBDMRIwEAYKCZImiZPyLGQBGRYCc2sxFTATBgoJkiaJk/IsZAEZFgVzZmVyYTEWMBQGA1UEAxMNU2ZlcmEgVEVTVCBDQTAeFw0xMjEwMDgwOTM3NTBaFw0xMzEwMDgwOTQ3NTBaMIGSMQswCQYDVQQGEwJTSzERMA8GA1UECBMIU2xvdmFraWExEzARBgNVBAcTCkJyYXRpc2xhdmExFTATBgNVBAoMDHNmw6lyYSwgYS5zLjEMMAoGA1UECwwDw5pWMRgwFgYDVQQDEw9TZmVyYSBURVNUIFVzZXIxHDAaBgkqhkiG9w0BCQEWDWluZm9Ac2ZlcmEuc2swgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMCMcBeOT8b3Wi3ihpThlU9i12lKAcOx3GPkrey1YN2UmT15Um1bctC1eUkDCS8NCsoenwTk5gFNgZjqX+F3+sdPQVUglNo7iU2/nMZ7gpRFgrgIDrBo/fomkx7hICMShqR5+YiX1KIz90bCbmpmus72/bd+7XKEsRzli4OIx7ztAgMBAAGjggIhMIICHTAOBgNVHQ8BAf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kN8K/PdspBw0=**</wsse:BinarySecurityToken>
   <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="SIG-8">
      <ds:SignedInfo>
         <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
            <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="wsa ns soap" />
         </ds:CanonicalizationMethod>
         <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
         <ds:Reference URI="#id-3">
            <ds:Transforms>
               <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                  <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="ns" />
               </ds:Transform>
            </ds:Transforms>
            <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
            <ds:DigestValue>**lFnegWV52e3LoBj3jNxW84oR5tU=**</ds:DigestValue>
         </ds:Reference>
         <ds:Reference URI="#id-4">
            <ds:Transforms>
               <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                  <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="ns" />
               </ds:Transform>
            </ds:Transforms>
            <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
            <ds:DigestValue>**Mvnq3Ms+cExBf1pfBeqNJLM+XEk=**</ds:DigestValue>
         </ds:Reference>
         <ds:Reference URI="#id-5">
            <ds:Transforms>
               <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                  <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="ns" />
               </ds:Transform>
            </ds:Transforms>
            <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
            <ds:DigestValue>**7ktvKkcQQqOm/Uk2cnFg30f9m/A=**</ds:DigestValue>
         </ds:Reference>
         <ds:Reference URI="#id-6">
            <ds:Transforms>
               <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                  <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="ns" />
               </ds:Transform>
            </ds:Transforms>
            <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
            <ds:DigestValue>**D2SnlCJRWR+F95gdjoK42ZI0D98=**</ds:DigestValue>
         </ds:Reference>
         <ds:Reference URI="#TS-1">
            <ds:Transforms>
               <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                  <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="wsse wsa ns soap" />
               </ds:Transform>
            </ds:Transforms>
            <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
            <ds:DigestValue>bsXg0RlneSpwynQ6czGW0nZ3tb4=</ds:DigestValue>
         </ds:Reference>
         <ds:Reference URI="#id-7">
            <ds:Transforms>
               <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                  <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="ns" />
               </ds:Transform>
            </ds:Transforms>
            <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
            <ds:DigestValue>**PjApypt2lSmahivJ0oCNKiud4p4=**</ds:DigestValue>
         </ds:Reference>
         <ds:Reference URI="#UsernameToken-2">
            <ds:Transforms>
               <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                  <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="wsa ns soap" />
               </ds:Transform>
            </ds:Transforms>
            <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
            <ds:DigestValue>**bR63weD24Ab0ddtBIt/RVeGSt1g=**</ds:DigestValue>
         </ds:Reference>
      </ds:SignedInfo>
      <ds:SignatureValue>**idE8pmhmkjY9c6ultBUrXSTukHfvjhiRdvEDViVIROyEgLE3lweNrtAvyLjalxrLJUGQWu63uvqM 9u4TFAi/moY7SeuLsb8Xd86hEAWWPkp061+Kpg5dV+17N8yDOfNx6wG0WQzchHzCzOKaceuqphQN aM92Qg8MVUsond9mkdI=**</ds:SignatureValue>
      <ds:KeyInfo Id="KI-536E4AA6BF962CA97613699845428202">
         <wsse:SecurityTokenReference wsu:Id="STR-536E4AA6BF962CA97613699845428213">
            <wsse:Reference URI="#X509-536E4AA6BF962CA97613699845428011" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" />
         </wsse:SecurityTokenReference>
      </ds:KeyInfo>
   </ds:Signature>
   <wsse:UsernameToken wsu:Id="UsernameToken-2">
      <wsse:Username>username</wsse:Username>
      <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
   </wsse:UsernameToken>
   <wsu:Timestamp wsu:Id="TS-1">
      <wsu:Created>2013-05-31T07:15:42.305Z</wsu:Created>
      <wsu:Expires>2013-05-31T10:02:22.305Z</wsu:Expires>
   </wsu:Timestamp>
</wsse:Security>

1 Answers1

0

Let me please ask - what are all those hashes and were can I get them? (they are "highlighted" with ** ** in code)

Those are SHA1 digest values which you can normally compute with e.g. following method if you are using the .NET framework:

System.Security.Cryptography.SHA1CryptoServiceProvider.ComputeHash(byte[] dataBytesToHash)

But, in your case, as this are WS-Security SOAP messages you don't have to compute those digest values 'by hand', please look here where you can find all informations needed to solve the task:

WS-Security using the ASMX file in ASP.NET 3.5

Community
  • 1
  • 1
Kr15
  • 595
  • 1
  • 6
  • 22