Overview
Features
Download
Documentation
Community
Add-Ons & Services

DOMWriter namespace writeNode() namespace reorganising

Please post support and help requests here.

DOMWriter namespace writeNode() namespace reorganising

Postby cashnl » 18 Nov 2009, 16:29

Hello,

I'm using Poco libraries for communicating with a webservice. The webservice requires me to sign the SOAP message with WS-S specifications.
I've implemented the required elements for my webservice. However the generated SignatureValue and DigestValue aren't being accepted.

After some debugging regarding the SignatureValue I've found out that when I use
Code: Select all
Poco::XML::DOMWriter writer;
writer.setOptions(Poco::XML::XMLWriter::CANONICAL);
writer.writeNode(transformedContent, signedInfo);

All of the namespaces from element 'signedInfo' it's parent nodes that are used in 'signedInfo' or one of its children are being transeffered over from parent elements into 'signedInfo' element. Furthermore, the name of the namespace also changed

So the following original XML:
Code: Select all
<ns4:SignedInfo>
  <ns4:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
  <ns4:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
  <ns4:Reference URI="#Body">
    <ns4:Transforms>
      <ns4:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
    </ns4:Transforms>
    <ns4:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <ns4:DigestValue>aNgp3mDX8R2LXvJCFpWh/Lsbg7M=</ns4:DigestValue>
  </ns4:Reference>
</ns4:SignedInfo>

Becomes:
Code: Select all
<ns1:SignedInfo xmlns:ns1="http://www.w3.org/2000/09/xmldsig#">
  <ns1:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
  <ns1:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
  <ns1:Reference URI="#Body">
    <ns1:Transforms>
      <ns1:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
    </ns1:Transforms>
    <ns1:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <ns1:DigestValue>aNgp3mDX8R2LXvJCFpWh/Lsbg7M=</ns1:DigestValue>
  </ns1:Reference>
</ns1:SignedInfo>


Normally this is the desired behaviour. But not in my case, since I want the original XML chunk unmodified so I can hash it with SHA1 and than encrypt it with RSA and finally encode it with Base64.

I'm really missing an innerHTML attribute. Something similiar like innerText attribute. Anyway I'd like to know if it's possible to output unmodifed XML with DOMWriter/XMLWriter. Otherwise Ill have to do ugly stuff like write the entire DOM to a file, and than only read out the SignedInfo element.

Thanks in Advance
cashnl
 
Posts: 3
Joined: 18 Nov 2009, 16:12

Return to Support

Who is online

Users browsing this forum: No registered users and 4 guests

cron