Methods Summary |
---|
protected java.lang.String | engineGetURI()Method engineGetURI
return implementedTransformURI;
|
protected com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput | enginePerformTransform(com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput input)
/**
* If the actual input is an octet stream, then the application MUST
* convert the octet stream to an XPath node-set suitable for use by
* Canonical XML with Comments. (A subsequent application of the
* REQUIRED Canonical XML algorithm would strip away these comments.)
*
* ...
*
* The evaluation of this expression includes all of the document's nodes
* (including comments) in the node-set representing the octet stream.
*/
/*
if (input.isOctetStream()) {
input.setNodesetXPath(Canonicalizer.XPATH_C14N_WITH_COMMENTS);
}
*/
Element transformElement = this._transformObject.getElement();
Node signatureElement = transformElement;
signatureElement = searchSignatureElement(signatureElement);
input.setExcludeNode(signatureElement);
input.addNodeFilter(new EnvelopedNodeFilter(signatureElement));
return input;
//
|
private static org.w3c.dom.Node | searchSignatureElement(org.w3c.dom.Node signatureElement)
boolean found=false;
while (true) {
if ((signatureElement == null)
|| (signatureElement.getNodeType() == Node.DOCUMENT_NODE)) {
break;
}
Element el=(Element)signatureElement;
if (el.getNamespaceURI().equals(Constants.SignatureSpecNS)
&&
el.getLocalName().equals(Constants._TAG_SIGNATURE)) {
found = true;
break;
}
signatureElement = signatureElement.getParentNode();
}
if (!found) {
throw new TransformationException(
"envelopedSignatureTransformNotInSignatureElement");
}
return signatureElement;
|