[
https://issues.apache.org/jira/browse/PDFBOX-912?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12965013#action_12965013
]
Thomas Chojecki commented on PDFBOX-912:
----------------------------------------
Ok sry, woking only with ITIL Jira and there it should be send to the product
manager first :)
The pdfbox architecture isn't a good base for incremental updates. The posted
solution need to be updated for real incremental updates.
The COSWriter need a starting object, i the case of signature it is the root
dict. and then following by the fields, annotation and sig. dict.
I didn't test it with document updates like adding a new page incrementally. It
can work if all objects between the root and the new object are marked with the
method needToBeUpdate() (this method indicate that an existing object was
modified and need to be wrote again in the incremental update), but i haven't
much hope this will work right now. the worst case is, that no update will be
done at all.
The next thing is, the whole document need to be read fully before doing a
incremental update. this wouldn't save memory. This is so, because we need to
know, which object is new and need to be write and which is old and should be
ignored.
The whole code is only optimized for signing.
The main reason for excluding the signing stuff is, there are many crypto
librarys out there and some people don't want to use only open source librarys
like bouncy castle for there signing solution. maybe it would be a good
subproject.
Please wait till next day and please implement it on a new branch for the first
time. The code need some optimization for a real stable and good standing.
i will comment some things tomorow but need sleep right now.
> PDF signing interface and improvments
> -------------------------------------
>
> Key: PDFBOX-912
> URL: https://issues.apache.org/jira/browse/PDFBOX-912
> Project: PDFBox
> Issue Type: Improvement
> Components: PDFReader, PDModel, PDModel.AcroForm, Writing
> Affects Versions: 1.4.0
> Reporter: Thomas Chojecki
> Priority: Minor
> Fix For: 1.4.0
>
> Attachments: cos_object_improvement_patch.txt,
> fields_annotations_patch.txt, interface_options_patch.txt, io_patch.txt,
> main_documents_patch.txt, parser_patch.txt, signature_exception_patch.txt,
> test.pdf, test_signed.pdf, writer_patch.txt
>
>
> 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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.