DOMSignContext signContext = new DOMSignContext(privateKey, document.getDocumentElement());
XMLSignature signature = this.xmlSignatureFactory.newXMLSignature(this.signedInfo, this.keyInfo);
signature.sign(signContext);
ByteArrayWriter writer = new ByteArrayWriter();
StreamResult streamResult = new StreamResult(writer);
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.transform(new DOMSource(document), streamResult);
currentData = writer.toByteArray();
}
return currentData;
} catch (Exception e) {
throw new SignerException(e);
}