How to add namespace while signing XML file using javax.xml.crypto.dsig.*?
问题 I'm trying to sign an xml file using enveloped signature and javax.xml.crypto.dsig.* classes. As a result I get file with correct Signature content but with no namespace defined. How can I add xmlns:ds="http://www.w3.org/2000/09/xmldsig#" namespace and corresponding ds prefixes? I don't see any place where I could define it. Example code: XMLSignatureFactory xmlSignatureFactory = XMLSignatureFactory.getInstance("DOM"); (...) XMLSignature signature = xmlSignatureFactory.newXMLSignature