xml-crypto Exclusive canonicalization

104 Views Asked by At

I'm using xml-crypto node.js package to perform Exclusive Canonicalization (http://www.w3.org/2001/10/xml-exc-c14n#) on my XML.

My end result is just slightly malformed:

  1. Canonicalized XML ends up being wrapped in empty angle brackets, so: <>..myxml..</>
  2. Canonicalized XML doesn't have correct whitespaces.

I'm attaching a screenshot illustrating the diff between the expected result (red precanonicalized code on the left) and my result (green code on the right) on a part of XML

enter image description here

How to have the end result be the same as the precanonicalized red code on the right? This is how I'm using the lib:

const ExclusiveCanonicalization = require('xml-crypto/lib/exclusive-canonicalization').ExclusiveCanonicalization;
const canonicalization = new ExclusiveCanonicalization();
const canonical = canonicalization.process(xmlRequestDOMDoc).toString()
0

There are 0 best solutions below