}
StringBuffer sb=new StringBuffer();
traverseElement((Element)el,sb);
if (os==null) {
byte[] decodedBytes = Base64.decode(sb.toString());
return new XMLSignatureInput(decodedBytes);
}
Base64.decode(sb.toString(),os);
XMLSignatureInput output=new XMLSignatureInput((byte[])null);
output.setOutputStream(os);
return output;
}
if (input.isOctetStream() || input.isNodeSet()) {
if (os==null) {
byte[] base64Bytes = input.getBytes();
byte[] decodedBytes = Base64.decode(base64Bytes);
return new XMLSignatureInput(decodedBytes);
}
if (input.isByteArray() || input.isNodeSet()) {
Base64.decode(input.getBytes(),os);
} else {
Base64.decode(new BufferedInputStream(input.getOctetStreamReal())
,os);
}
XMLSignatureInput output=new XMLSignatureInput((byte[])null);
output.setOutputStream(os);
return output;
}
try {
//Exceptional case there is current not text case testing this(Before it was a
//a common case).
Document doc =
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(
input.getOctetStream());
Element rootNode = doc.getDocumentElement();
StringBuffer sb = new StringBuffer();
traverseElement(rootNode,sb);
byte[] decodedBytes = Base64.decode(sb.toString());
return new XMLSignatureInput(decodedBytes);
} catch (ParserConfigurationException e) {
throw new TransformationException("c14n.Canonicalizer.Exception",e);
} catch (SAXException e) {
throw new TransformationException("SAX exception", e);
}