1. PDFBox
  2. PDFBOX-912

PDF signing interface and improvments



      This is a first version of a signing interface for pdfbox. There are some design issues i could not handle without rewriting too much of the code.

      Here we go:

      • incremental update support (tested for signatures with pdf/a compatibility), not compatible with encrypted documents nor with xref-streams
      • cos object improvment
        • COSString with ability to force writing hexbin for given string
        • COSBase with ability to write direct into a dictionary (that means if this is set, no indirect object will be wrote) (sry hard to explain what i mean, actualy needed for incremental update to lower the rate of indirect objects)
        • COSBase with ability to force writing object (this hook help the COSWriter write needed objects for inkremental update)
        • COSName added new names
        • COSDocument some getter and setter for handling new signature and incremental features
      • SignatureException with some exceptions for handling the bunch of new possible errors

      -Parser improvments
      – PDFParser saves now the position of the last startxref
      – VisualSignatureParser (hook for parsing visual signature templates) (it's only for prepared visualisation that should be merged with the document)

      -IO improvments
      – COSFilterInput helps to find the proper content that should be hashed / signed
      – COSStandardOutputStream is tricky, it helps the writer to jump to the right place in the document
      – COSWriter got some improvments for incremental update
      – COSWriterXRefEntry needed for incremental updates and writing the new Xref table

      • PDDocument
        • got a new method addSignature with the needed implementation (do the whole signature stuff)
        • cleanup
      • Fields and Annotations
        • PDSignature represent the signature dictionary
        • PDSignatureFild / Annotation are the visible & unvisible signature representations
      • Signature Interface and options
        • SignatureInterface the interface that shall be implemented for proper signing
        • SignatureOptions, some additional options for signing

      Patch splited into pieces

      sry for spelling, didn't include a spellchecker for english.

      1. writer_patch.txt
        28 kB
        Thomas Chojecki
      2. test.pdf
        23 kB
        Thomas Chojecki
      3. test_signed.pdf
        61 kB
        Thomas Chojecki
      4. signature_exception_patch.txt
        3 kB
        Thomas Chojecki
      5. parser_patch.txt
        11 kB
        Thomas Chojecki
      6. main_documents_patch.txt
        20 kB
        Thomas Chojecki
      7. io_patch.txt
        6 kB
        Thomas Chojecki
      8. interface_options_patch.txt
        2 kB
        Thomas Chojecki
      9. fields_annotations_patch.txt
        17 kB
        Thomas Chojecki
      10. cos_object_improvement_patch.txt
        7 kB
        Thomas Chojecki

        Issue Links



            • Assignee:
              Adam Nichols
              Thomas Chojecki
            • Votes:
              0 Vote for this issue
              6 Start watching this issue


              • Created: