}
StringBuilder sb = new StringBuilder();
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).
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
Document doc =
dbf.newDocumentBuilder().parse(input.getOctetStream());
Element rootNode = doc.getDocumentElement();
StringBuilder sb = new StringBuilder();
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);
}