这是我签署 XML 文档的代码:
KeyingDataProvider kp = new FileSystemKeyStoreKeyingDataProvider(keyStoreType,
keyStorePath, certificateSelector, keyStorePasswordProvider,
entryPasswordProvider, returnFullChain);
XadesSigningProfile p = new XadesBesSigningProfile(kp);
XadesSigner signer = p.newSigner();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
docSource = builder.parse(new FileInputStream(pathToXmlFile));
docDest = builder.newDocument();
Node objContent = docDest.importNode(docSource.getDocumentElement(), true);
DataObjectDesc obj = new EnvelopedXmlObject(objContent, "text/xml", null);
new Enveloped(signer).sign(docSource.getDocumentElement());
现在,我需要在同一个 XML 文件中添加反签名。你能给我一些建议吗?目前我没有任何想法:(
我的 XML 文件如下所示:
<rootElement>
<A>
<A1>
</A1>
</A>
</rootElement>
第一次签名后,我有:
<rootElement>
<A>
<A1>
</A1>
</A>
<ds:Signature>
</ds:Signature>
</rootElement>
最好的问候约翰 S。