Has anyone ever been in this situation? Error assigning content in signature tag: Signature - > Reference - > URI
When assigning content in the Signature Reference URI tag I'm getting an EXCEPTION , see below:
javax.xml.crypto.dsig.XMLSignatureException: javax.xml.crypto.URIReferenceException: com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverException: Cannout resolve element with ID IDnnnnnnnnnn
In some literature / forum, quote, I already did, the implementation of the code:
...
String id = el.getAttribute("id");
el.setIdAttribute("id", true);
...
Reference ref = fac.newReference("#".concat(id), fac.newDigestMethod("http://www.w3.org/2001/04/xmlenc#sha256", null),transformList, null, null);
...
The "id" is exactly this way in the input XML. The ID content in the Reference is being generated correctly, but when I run the below template, I get this exception . (Cannout resolve element with ID IDnnnnnnnnnn)
signature.sign(dsc);