santuario-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabio Mondelli <fmonde...@mtg.de>
Subject signed xml does no more contain: <?xml version="1.0" encoding="UTF-8"?>
Date Thu, 09 Feb 2006 10:00:01 GMT
Hello,
I want to sign and verify xml files.

in my case, the signed file does not contain the first line: <?xml 
version="1.0" encoding="UTF-8"?> from the original document.

what could be the reason? Im doing a enveloped xml signature.

here is the code:

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
             dbf.setNamespaceAware(true);
             DocumentBuilder db = dbf.newDocumentBuilder();
             Document doc = 
db.parse(parameterObject.getUnsignedInputXMLFile());
             String BaseURI = 
parameterObject.getSignedXMLFile().toURL().toString();
             XMLSignature sig = new XMLSignature(doc, BaseURI, 
XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1);
...


             Element rootElement = doc.getDocumentElement();
             rootElement.insertBefore(sig.getElement(), 
rootElement.getFirstChild());
             sig.addResourceResolver(new OfflineResolver());
             Transforms transforms = new Transforms(doc);
 
transforms.addTransform(Transforms.TRANSFORM_ENVELOPED_SIGNATURE);
transforms.addTransform(Transforms.TRANSFORM_C14N_WITH_COMMENTS);

thank U!

Mime
View raw message