[Poppler-bugs] [Bug 99416] Sign PDF with digital signature

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Aug 28 14:20:38 UTC 2017


https://bugs.freedesktop.org/show_bug.cgi?id=99416

--- Comment #20 from Hans-Ulrich Jüttner <huj at froreich-bioscientia.de> ---
(In reply to Adrian Johnson from comment #19)
> (In reply to Hans-Ulrich Jüttner from comment #18)
> > > After saving the PDF, open the saved PDF in a new PDFDoc object.
> > > 
> > 
> > How is this supposed to be done? The user of the library calls the method
> > sign() from the Qt5 interface or signDocument() from poppler/Form.h via some
> > other interface. Are you saying that the doc member of type PDFDoc* within
> > the
> > FormFieldSignature object should be replaced by a new one? I think that can't
> > work because there are other references to the PDFDoc object in the library
> > outside the FormFieldSignature object.
> 
> Create a temporary PDFDoc* variable for the purpose of opening the PDF and
> getting the size and offset of the sig object. You can have more than one
> PDFDoc object at the same time.
> 

Sorry, I do not understand what a temporary PDFDoc object should help.

> > The user of the library opens the PDF document, than perhaps makes some
> > changes
> > and finally calls the method FormFieldSignature::sign() from the Qt5
> > interface.
> > Afterwards he saves the changed document with the PDFConverter class of the
> > Qt5 interface. If he makes other changes to the document after calling sign()
> > but before saving, the signature will of course be no longer valid.
> 
> Well yes changing the document after adding a signature will break the
> signature. I'm not seeing the problem here. Maybe warn the user if he tries
> to change a signed document.
> 
> > The problem is not saving a few bytes but specifying the final byte offsets.
> > If a byte offset changes the number of digits may vary at least between 6 and
> > 10. If for example the total length of the document increases, the byte range
> > object might have to increase in size too because an additional digit is used
> > for that length. Thus in turn the start offset of the signature is shifted by
> > one byte because the byte range object is located in front of the signature.
> 
> When saving, set each offset to 9999999999, then search for and overwrite
> the 9's with the correct offsets.

That wouldn't help. The byte range object would shrink when these values later
are replaced by the correct smaller values. If you mean these values should be
overwritten on disk that would also be no solution as this is only a temporary
file and the file written later by the user would differ from it by some
missing blanks that have overwritten your 9's.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler-bugs/attachments/20170828/81a9d45b/attachment.html>


More information about the Poppler-bugs mailing list