Digital Signing of XFA forms

痴心易碎 提交于 2019-12-10 12:14:45

问题


I'd like to sign PDF documents created in Adobe Livecycle (it is XFA form) programmatically.

I know about iText library for manipulating with PDFs, but I haven't found any example how to sign it yet.

Maybe its not supported yet. Do you know any other Java library which can do that? Or do you know a way how to sign it?

I know, my question is similar to this opened question, but I don't need the use of iText.

Thank you very much for your help!


回答1:


This is a small example showing how to sign using XmlDSig:

PdfReader reader =new  PdfReader(src);
FileOutputStream os =new  FileOutputStream(dest);
PdfStamper stamper = PdfStamper.createXmlSignature(reader, os);
XmlSignatureAppearance appearance = stamper.getXmlSignatureAppearance();
appearance.setXmlLocator(new  XfaXmlLocator(stamper));
appearance.setXpathConstructor(new XfaXpathConstructor(XfaXpathConstructor.XdpPackage.Datasets));
ExternalSignature signature =new  PrivateKeySignature(pk, digestAlgorithm,"BC");
//use signXmlDSig or signXades
MakeXmlSignature.signXmlDSig(appearance, signature, chain);

You can also sign using XAdES, but then you won't be able to validate the signature in Adobe software because I don't think Adobe already supports XAdES (please correct me if I'm wrong).



来源:https://stackoverflow.com/questions/21749485/digital-signing-of-xfa-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!