/** @inheritDoc */
protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input,OutputStream os)
throws IOException, CanonicalizationException {
try {
Canonicalizer20010315WithComments c14n = new Canonicalizer20010315WithComments();
if (os!=null) {
c14n.setWriter( os);
}
c14n.set_includeComments(!input.isExcludeComments());
byte[] result = null;
if (input.isOctetStream()) {
result = c14n.engineCanonicalize(input.getBytes());
} else {
if (input.isElement()) {
Node excl=input.getExcludeNode();
result=c14n.engineCanonicalizeSubTree(input.getSubNode(),excl);
} else {
Set set=input.getNodeSet(true);
result = c14n.engineCanonicalizeXPathNodeSet(set);
}
}
XMLSignatureInput output=new XMLSignatureInput(result);
if (os!=null) {
output.setOutputStream(os);