context.setProperty("javax.xml.crypto.dsig.cacheReference", Boolean.TRUE);
context.setProperty("org.apache.jcp.xml.dsig.secureValidation", Boolean.TRUE);
context.setProperty(STRTransform.TRANSFORM_WS_DOC_INFO, wsDocInfo);
try {
XMLSignature xmlSignature = signatureFactory.unmarshalXMLSignature(context);
// Test for replay attacks
testMessageReplay(elem, xmlSignature.getSignatureValue().getValue(), data, wsDocInfo);
setElementsOnContext(xmlSignature, (DOMValidateContext)context, wsDocInfo, elem.getOwnerDocument());
boolean signatureOk = xmlSignature.validate(context);
if (signatureOk) {
return xmlSignature;
}
//
// Log the exact signature error
//
if (LOG.isDebugEnabled()) {
LOG.debug("XML Signature verification has failed");
boolean signatureValidationCheck =
xmlSignature.getSignatureValue().validate(context);
LOG.debug("Signature Validation check: " + signatureValidationCheck);
java.util.Iterator<?> referenceIterator =
xmlSignature.getSignedInfo().getReferences().iterator();
while (referenceIterator.hasNext()) {
Reference reference = (Reference)referenceIterator.next();
boolean referenceValidationCheck = reference.validate(context);
String id = reference.getId();
if (id == null) {