简体   繁体   中英

Digital Signing of XFA forms

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!

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM