signatureFactory.newTransform(
STRTransform.TRANSFORM_URI,
structure
);
} else {
TransformParameterSpec transformSpec = null;
if (wssConfig.isWsiBSPCompliant()) {
Element toSignById = element;
if (toSignById == null) {
if (callbackLookup == null) {
callbackLookup = new DOMCallbackLookup(doc);
}
toSignById = callbackLookup.getElement(idToSign, null, false);
wsDocInfo.addProtectionElement(toSignById);
}
List<String> prefixes = getInclusivePrefixes(toSignById);
transformSpec = new ExcC14NParameterSpec(prefixes);
}
transform =
signatureFactory.newTransform(
WSConstants.C14N_EXCL_OMIT_COMMENTS,
transformSpec
);
}
if (element != null) {
wsDocInfo.addProtectionElement(element);
}
javax.xml.crypto.dsig.Reference reference =
signatureFactory.newReference(
"#" + idToSign,
digestMethod,
Collections.singletonList(transform),
null,
null
);
referenceList.add(reference);
} else {
String nmSpace = encPart.getNamespace();
List<Element> elementsToSign = null;
if (element != null) {
elementsToSign = Collections.singletonList(element);
} else {
if (callbackLookup == null) {
callbackLookup = new DOMCallbackLookup(doc);
}
elementsToSign =
WSSecurityUtil.findElements(encPart, callbackLookup, doc);
}
if (elementsToSign == null || elementsToSign.size() == 0) {
throw new WSSecurityException(
WSSecurityException.FAILURE,
"noEncElement",
new Object[] {nmSpace + ", " + elemName}
);
}
for (Element elementToSign : elementsToSign) {
wsDocInfo.addProtectionElement(elementToSign);
TransformParameterSpec transformSpec = null;
if (wssConfig.isWsiBSPCompliant()) {
List<String> prefixes = getInclusivePrefixes(elementToSign);
transformSpec = new ExcC14NParameterSpec(prefixes);
}
Transform transform =