Reinf - Problems assigning content in the Reference URI tag

2

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);
    
asked by anonymous 14.06.2018 / 21:09

1 answer

0

Actually, in some of the literature I've researched, the RUIReferenceException is updating the JAVA version by ORACLE.

But the error in my case was that there were two DOCUMENT INSTANCES in the source. One of them (EX: DOC) was handling the ID and another (EX> DOCS) was handling the SIGNATURE.

I deleted one of the instances, correcting the code and RESOLVED.

    
15.06.2018 / 15:40