Bug 104815 - Signing of compressed PDF does not work
Summary: Signing of compressed PDF does not work
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
5.3.0.0.beta2
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 120892 (view as bug list)
Depends on:
Blocks: Digital-Signatures
  Show dependency treegraph
 
Reported: 2016-12-20 16:22 UTC by Martin Pietsch
Modified: 2022-06-06 03:26 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
PDF files which will not function (288.83 KB, application/x-gzip)
2016-12-20 16:22 UTC, Martin Pietsch
Details
simple example document where signing succeeds/fails (55.76 KB, application/zip)
2018-10-26 10:26 UTC, Ansgar Burchardt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Pietsch 2016-12-20 16:22:46 UTC
Created attachment 129812 [details]
PDF files which will not function

Dear LibreOffice-Team,

the function to sign an existing PDF is a very good feature and I tried it with different PDF-files. The result has shown for me that the signing-procedure only function with PDF's which was created by LibreOffice. With other PDF I can select a signature but this will not added to the PDF and the signature list of the main signing dialog remained empty. Futhermore neither an error, warning nor other information is displayed. The only thing that happens, that the PDF is damanaged after this action.

You find an example PDFs, which will not function, before and after the signing process in the attachment.

What is the reason? Am I doing something wrong?

Thank you in advance for your effort.

Best regards,
Martin
Comment 1 Cor Nouws 2016-12-20 17:26:52 UTC Comment hidden (obsolete)
Comment 2 Ansgar Burchardt 2017-01-03 12:58:21 UTC
I can reproduce this with LibreOffice 5.3.0~rc1 (from Debian): signing the provided PDF files doesn't work and trying to do so produces a PDF file only including page 2 (and missing page 1).

As a workaround, opening the PDF and exporting it again allows to sign the file (then also via the "Sign existing PDF" option). However this should lose all signatures already present.

My suspicion is that this is related to the PDF version: the provided `test_before.pdf` is PDF-1.6; the files I could sign were PDF-1.4 or before.  This blog post suggests that it should work with newer PDF versions as well: http://vmiklos.hu/blog/pdf-sign.html, but maybe there are still some bugs in this new feature?

[ Added vmiklos to the CC list ]
Comment 3 QA Administrators 2017-07-27 12:06:48 UTC Comment hidden (obsolete)
Comment 4 Cor Nouws 2017-08-11 13:03:40 UTC
I confirm the problem in Version: 6.0.0.0.alpha0+
Build ID: 368b583b992f2e9cad46c2362c9529a07c36d7a9
CPU threads: 4; OS: Linux 4.10; UI render: default; VCL: gtk2; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2017-08-10_02:55:46
Locale: nl-NL (nl_NL.UTF-8); Calc: group

and in 5.4.0.3 on Win 10-64 (6.19)
Comment 5 Cor Nouws 2017-08-11 13:44:39 UTC
when trying to sign the PDF file from attachment 129812 [details], I do
 - select a certificate in the dialog Select Certificate
 - click OK
 > but then do not see the signature in the dialog Digital Signatures

(After closing and reopening the PDF for signing, the certificate is shown)
Comment 6 Cor Nouws 2017-08-11 13:55:57 UTC Comment hidden (no-value)
Comment 7 Juan Jose Pablos 2018-10-07 23:48:19 UTC
Hi,
Maybe is a problem with that file.

Trying to validate your document using this online test. fail
https://www.pdf-online.com/osa/validate.aspx

But, if you export using libre office. this resulted file. passed the test.
Comment 8 Ansgar Burchardt 2018-10-26 10:26:34 UTC
Created attachment 146029 [details]
simple example document where signing succeeds/fails

I've attached simpler PDF documents with just the world "Hallo." that show the documented problem.  The pdfTeX source is also included.

I can sign pdf15uncompressed.pdf (which sets '\pdfobjcompresslevel=0') without problems.  The signature is shown as valid by libreoffice-writer.

Signing pdf15compressed.pdf (which uses the default \pdfobjcompresslevel setting) fails and produces an invalid PDF (that cannot be opened using either evince or libreoffice-writer).

I tried with libreoffice-writer 1:6.1.3~rc1-1 and 1:6.2.0~alpha1-1 (from Debian)
Comment 9 Timur 2018-10-26 13:05:51 UTC
Ansgar, if you are right, than we should update the title with "compressed PDF".
Your PDF's are version 1.5. 
Although you already found that it should work with newer PDF versions, can you please try to create version 1.6, to be sure?

I tried to find a method to test whether PDF is compressed, only hint is to use: 
strings your.pdf | grep /Filter
But I don't find it reliable.
Comment 10 Ansgar Burchardt 2018-10-26 13:28:43 UTC
Timur, I tried changing \pdfminorversion=5 to \pdfminorversion=6.  This shows the same problems with signing the uncompressed version.

The PDF 1.5/1.6 files generated this way by pdfTeX are almost identical.  The only difference are version number, timestamps and some ID:

-%PDF-1.5
+%PDF-1.6

-/CreationDate (D:20181026151605+02'00')
-/ModDate (D:20181026151605+02'00')
+/CreationDate (D:20181026151606+02'00')
+/ModDate (D:20181026151606+02'00')

-/ID [<85B2B94E82913D769D6C5843FF158106> <85B2B94E82913D769D6C5843FF158106>]
+/ID [<3183843648EC5FDFF762CA8F3B1A7532> <3183843648EC5FDFF762CA8F3B1A7532>]

I don't know anything about the PDF file format so cannot say how to identify files using object compression.  I just found the "\pdfobjcompresslevel=0" option when trying to generate a PDF Libreoffice could sign earlier this month.
Comment 11 Timur 2018-11-05 09:56:16 UTC
*** Bug 120892 has been marked as a duplicate of this bug. ***
Comment 12 Timur 2020-06-05 07:37:33 UTC
Possible example attachment 161609 [details].
Comment 13 QA Administrators 2022-06-06 03:26:49 UTC
Dear Martin Pietsch,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug