Need working example of xml canonicalization with javax.xml.*

MajorieBilich

New Member
I have had working prototype of canonicalize function that I wanted to use in the application I am working on. One of the functions in my app reads an xml document from file and then canonicalizes one of the nodes found in it. Unfortunately prototype was using com.sun.org.apache.xml.internal.security.* importwhich I didn't know shouldn't be used.As long as I was using "Run File" in my Netbeans all was working fine. Then finally I decided to compile and ... what a surprise - I can't compile. After googling I found that "com.sun.**.internal.** classes are not part of the JRE's exposed API and code is forbidden to compile against them" My code used canonicalizer located in the mentioned classes ... it seems it can't be done do that way.I then realized that there is javax.xml.crypto.dsigFor instance it seems that http://download.java.net/jdk8/docs/technotes/guides/security/xmldsig/GenDetached.java is pretty close to what I need. The example creates xml digital signature, and in the meantime is doing canonicalization.I am java beginner. I am trying but I don't know how to produce canonized xml only based on the example provided.Hope you can help me and will appreciate that very much.
 
Back
Top