PDFBox - opening and saving a signed pdf invalidates my signature

前端 未结 2 1108
走了就别回头了
走了就别回头了 2020-12-18 09:01

I am trying to learn to use Apache\'s pdfBox to deal with digitaly signed documents for work. During testing, I created a completely empty pdf document.

I then signe

相关标签:
2条回答
  • 2020-12-18 09:14

    The problem is that using PDDocument.save() creates a new document and thus invalidates the signature.

    Using PDDocument.saveIncremental(...) does not invalidate the signature, however it will not update any changes to the document (such as annotations or form filling), it is only used to save a signature.

    Updating a signed PDF document with annotations or form filling is not yet possible with PDFBox 2.0 but should be possible once PDFBox 2.1 rolls out.

    Information on the problem : here and here

    Using IText's PDFStamper however solve the problem of adding annotations to a signed document without invalidating the signature as answered here.

    0 讨论(0)
  • 2020-12-18 09:36

    From what I can gather from some of Adobe's documentation, there is a timestamp which is included as part of the signature. I would guess by saving the document (even without any content changes) would modify this timestamp value, hence invalidating the signature (which would have been created using the original timestamp).

    This isn't an authoritative, mind you - this is just what I've been able glean from a quick glance at Adobe's documentation on the matter.

    0 讨论(0)
提交回复
热议问题