I don't think we can tell XMLSignature not to print that special part.Because that is the part of the XMLSignature designed by W3C.However you can parse the document and remove it.But it will fail when you do the validation.
-----Original Message----- From: Michael Kail [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 21, 2006 9:25 AM To: [email protected] Subject: AW: Remove KeyValue from xml signature Thanks for your request Murugan! But that's not my problem... Let me rephrase that(bad English...) :) I have an xml file. I'm signing it and create an enveloped xml file, containing my data and the the signature information. But I don't need All information of the signature elements. There is a tag called KeyValue: <Signature> <SignInfo> ... <KeyValue> </Signature> I want't to tell the xmlsignature class not to print that special Part into xml structure. Does anybody know???? Michael -----Ursprüngliche Nachricht----- Von: Murugan Selvaraj [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 21. März 2006 17:06 An: [email protected] Betreff: RE: Remove KeyValue from xml signature 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
