How to change the signature ID "xmldsig-e8129bc4-957f-4e9c-b8dc-d0a3482bb97b" by "SigFrs" ?
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="xmldsig-e8129bc4-957f-4e9c-b8dc-d0a3482bb97b">
This is my code :
XadesSigningProfile p = new XadesBesSigningProfile(kp);
XadesSigner signer = p.newSigner();
javax.xml.parsers.DocumentBuilderFactory factory = javax.xml.parsers.DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
javax.xml.parsers.DocumentBuilder builder = null;
builder = factory.newDocumentBuilder();
// XML FILE TO BE SIGNED
Document doc1 = builder.parse(new File("FileNotSigned.xml"));
// OBJ
IndividualDataObjsTimeStampProperty dataObjsTimeStamp = new IndividualDataObjsTimeStampProperty();
AllDataObjsCommitmentTypeProperty globalCommitment = AllDataObjsCommitmentTypeProperty.proofOfApproval();
CommitmentTypeProperty commitment = CommitmentTypeProperty.proofOfCreation();
// OBJECT
DataObjectDesc obj1 = new DataObjectReference("");
obj1.withTransform(XPath2Filter.intersect("InvoiceHeader"));
SignedDataObjects dataObjs = new SignedDataObjects( obj1 );
// SIGN
signer.sign(dataObjs, nodeToAttachSignature);
// TRANSFORMER
Transformer transformer = TransformerFactory.newInstance().newTransformer();
// XML SIGNED
Result output = new StreamResult(new File("FileSigned.xml"));
Source input = new DOMSource(doc1);
transformer.transform(input, output);
Currently, there's no way to change those IDs, as they are auto generated internally to ensure they are unique.
Source code: https://github.com/luisgoncalves/xades4j/blob/master/src/main/java/xades4j/production/SignerBES.java#L154
Similar question: XADES4J - How to change <ds:Object Id="xmldsig-1ddcf1ab-7648-4039-b166-69e14da39982-object0"...> to something other id