Node invoice = XML.getDocumentElement();
XMLStructure content = new DOMStructure(invoice);
XMLObject obj = fac.newXMLObject(Collections.singletonList(content), "invoice", null, null);
// Step 4: Create the SignedInfo object.
SignedInfo si = fac.newSignedInfo(fac.newCanonicalizationMethod(CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS, (C14NMethodParameterSpec) null),
fac.newSignatureMethod(SignatureMethod.DSA_SHA1, null), Collections.singletonList(ref));
// Step 5 : Retrieve private and public key from keystore
KeyPair kp = KeyStoreUtil.getKeyPair(KEYSTORE, KEYSTORE_PASSWORD, PRIVATE_KEY_ALIAS_PASSWORD, PRIVATE_KEY_ALIAS);