Hi Michael. Once you sign the document , you can use put the signed content to the another file .The code for implementing is as follows.
xmlFile - is the name of the file where you want to send the O/P. java.io.FileOutputStream out = new java.io.FileOutputStream(xmlFile); org.apache.xml.security.utils.XMLUtils.outputDOMc14nWithComments(doc, out); Murugan -----Original Message----- From: Michael Kail [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 21, 2006 4:06 AM To: [email protected] Subject: Remove KeyValue from xml signature Hi to all! I'v got a problem: I'm creating an enveloped xml signature. That works. But in the signed document is Field KeyValue that contains DSAKeyValue. And I just wan't to know if there is any Way to tell xmlsignature not to write that information into document(as we don't need it). Here's my current code: javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder(); org.w3c.dom.Document doc = db.parse(signatureFile); String BaseURI = signatureFile.toURL().toString(); ElementProxy.setDefaultPrefix("http://www.w3.org/2000/09/xmldsig#",null) ; XMLSignature sig = new XMLSignature(doc, BaseURI, XMLSignature.ALGO_ID_SIGNATURE_DSA); //add siognature infomaetion to document Node nl = doc.getFirstChild(); nl.appendChild(sig.getElement()); Transforms transforms = new Transforms(doc); transforms.addTransform(Transforms.TRANSFORM_ENVELOPED_SIGNATURE); //add document "archivdescriptor" to signed content sig.addDocument("", transforms, Constants.ALGO_ID_DIGEST_SHA1); Hope there's anybody who got a hint! Thanks for help, michael
