Exception: Apache xmlsec IdResolver could not resolve the Element for id reference while decrypting

org.opensaml.xml.validation.ValidationException: Apache xmlsec IdResolver could not resolve the Element for id reference:

This is an example of a common exception that can be thrown when verifying a signature after decryption an object.

To avoid this, it is often enough to configure your Decrypter using the following setting before decrypting.

1decrypter.setRootInNewDocument(true);