ParserConfigurationException, XmlSignatureFormatException {
// Find Signature element
NodeList nl = doc.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature");
if (nl.getLength() == 0) {
throw new XmlSignatureFormatException(
"Message is not a correct XML signature document: 'Signature' element is missing. Check the sent message.");
}
if (nl.getLength() != 1) {
throw new XmlSignatureFormatException(
"XML signature document is not supported; it contains more than one signature element. Check the sent message.");
}
Node signatureNode = nl.item(0);
LOG.debug("Signature element found");
return signatureNode;