Document document = this.documentBuilderFactory.newDocumentBuilder().parse(inputStream);
DOMSignContext signContext = new DOMSignContext(privateKey, document.getDocumentElement());
XMLSignature signature = this.xmlSignatureFactory.newXMLSignature(this.signedInfo, this.keyInfo);
signature.sign(signContext);
Document outputDocument = this.documentBuilderFactory.newDocumentBuilder().newDocument();
DOMResult domResult = new DOMResult(outputDocument);
TransformerFactory transformerFactory = TransformerFactory.newInstance();