Thanks Raul, your suggestion led me to solve one problem. I was using an old version of Glue/ElectricXML (2.3.1) as input to the canonicalizer. Apparently, there is some sort of problem with the DOM in that old version. Swapping in Glue 5.0.2 to produce the DOM, the xml security canonicalizer produced output that exactly matches the .NET canonicalizer.
I'm having a problem that is corollary to this. Instead of using Glue/ElectricXML to produce the xml Document to canonicalize I'm trying to use the javax.xml.* APIs, since I may not be able to easily upgrade the glue version. I can't get the output from this input form to match the canonicalization done by .NET, and now the updated Glue/ElectricXML. I am not too familiar with the javax.xml APIs, but I'm using the following code to canonicalize the same document as before: Document doc = DocumentBuilderFactory.newInstance(). newDocumentBuilder().parse(f); Init.init(); Canonicalizer c14n = Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_WITH_COMMENTS); byte[] bytes = c14n.canonicalizeSubtree(doc); // ... write to file ... The canonicalizer produces output that is nothing like the canonicalized form produced by .NET and the Glue input based canonicalization: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <soap:Body> <n:getRate xmlns:n="urn:xmethods-CurrencyExchange"> <country1 xsi:type="xsd:string">usa</country1> <country2 xsi:type="xsd:string">japan</country2> </n:getRate> </soap:Body> <!-- test comment --> <testElement a="1" b="2" c="3"> test crapola </testElement> </soap:Envelope> Nothing like the results from .NET and Glue: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><soap:Body><n :getRate xmlns:n="urn:xmethods-CurrencyExchange"><country1 xsi:type="xsd:string">usa</country1><country2 xsi:type="xsd:string">japan</country2></n:getRate></soap:Body><!-- test comment --><testElement a="1" b="2" c="3">
 test crapola
 </testElement></soap:Envelope> Any help on this is very much appreciated. Thanks Skip Walker [EMAIL PROTECTED] Gossamer Group Bldg #2, Suite 410 4807 Spicewood Springs Rd. Austin, TX 78759 (512) 342-2600 Fax (512) 342-2612 -----Original Message----- From: Raul Benito [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 30, 2005 4:16 AM To: security-dev@xml.apache.org Subject: Re: Java XML C14n interop with .Net The java output looks weird perhaps your DOM tree is not well constracted. Can you just plain serializae your DOM tree to se what really has. On Tue, 29 Mar 2005 15:47:48 -0600, Skip Walker <[EMAIL PROTECTED]> wrote: > > I'm relatively new to most of this stuff. > > Does anyone have any experience with the Java XML Security package and .Net > C# interopability? > > I'm trying to get xml, canonicalized using the XML Security package in Java, > to be canonicalized in the same way the .Net > XmlDsigC14NWithCommentsTransform canonicalizes XML, or vice versa. I need > to do this for some custom signature stuff I need to do on the xml. > > I can't seem to get the canonicalized xml to match up. There appear to be > issues with the namespaces. > > With an example message of > > <soap:Envelope > xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' > xmlns:xsd='http://www.w3.org/2001/XMLSchema' > xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' > xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' > soap:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'> > <soap:Body> > <n:getRate xmlns:n='urn:xmethods-CurrencyExchange'> > <country1 xsi:type='xsd:string'>usa</country1> > <country2 xsi:type='xsd:string'>japan</country2> > </n:getRate> > </soap:Body> > > <!-- test comment --> > <testElement c='3' b='2' a='1'> > test crapola > </testElement> > </soap:Envelope> > > I'm using the Canonicalizer.ALGO_ID_C14N_WITH_COMMENTS in java to produce > > <soap:Envelope soap="http://schemas.xmlsoap.org/soap/envelope/" > soapenc="http://schemas.xmlsoap.org/soap/encoding/" > xsd="http://www.w3.org/2001/XMLSchema" > xsi="http://www.w3.org/2001/XMLSchema-instance" > http://schemas.xmlsoap.org/soap/envelope/:encodingStyle="http://schemas.xmls oap.org/soap/encoding/"><soap:Body><n:getRate > n="urn:xmethods-CurrencyExchange"><country1 > http://www.w3.org/2001/XMLSchema-instance:type="xsd:string">usa</country1><c ountry2 > http://www.w3.org/2001/XMLSchema-instance:type="xsd:string">japan</country2> </n:getRate></soap:Body><!-- > test comment --><testElement a="1" b="2" c="3">
 > test crapola
 > </testElement></soap:Envelope> > > But using the XmlDsigC14NWithCommentsTransform in .Net C# to produce > > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><soap:Body><n :getRate > xmlns:n="urn:xmethods-CurrencyExchange"><country1 > xsi:type="xsd:string">usa</country1><country2 > xsi:type="xsd:string">japan</country2></n:getRate></soap:Body><!-- test > comment --><testElement a="1" b="2" c="3">
 > test crapola
 > </testElement></soap:Envelope> > > If anyone can help, I would appreciate it. > > Thanks, > > Skip > > -- http://r-bg.com