question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sign pdf with password may corrupt file

See original GitHub issue

Hi

edit: I did a test with a non-empty password and I got the same result. Checking now endesive-2.0.5 edit2: Probably related to: pdf signing will not work correctly when only owner password is set for the pdf and the permission settings will be ignored by cms.sign

I use your nice library to sign automatically generated pdfs. Unfortunately sometime I run into problems.

  1. The pdf is gererated using enscript and ps2pdf
  2. Then I use qpdf --encrypt "" "" 128 --extract=n --accessibility=n --modify=none to apply some restrictions but without any password
  3. Then I use your pdf-sign-cms.py script to sign the pdf

The unfortunate outcome is that sometimes my pdf reader asks for a password, even none is set. pdfcrack told me that the password is ‘’. But this works only for qpdf with the option --password-is-hex-key.

x:~$ qpdf --decrypt --password="" --password-is-hex-key /media/sf_shared_folder/TEST_encr-signed-cms.pdf x.pdf
WARNING: /media/sf_shared_folder/TEST_encr-signed-cms.pdf (offset 458): error decoding stream data for object 3 0: stream inflate: inflate: data: incorrect header check
WARNING: /media/sf_shared_folder/TEST_encr-signed-cms.pdf (offset 458): stream will be re-processed without filtering to avoid data loss
qpdf: operation succeeded with warnings; resulting file may have some problems

Attached are the files for the steps above:

  1. TEST_unsec.pdf
  2. TEST_encr.pdf
  3. TEST_encr-signed-cms.pdf

The used version is endesive-2.0.2.tar.gz

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
m32commented, May 8, 2021

The ID was incorrectly copied from the previous document, try with 2.0.6

0reactions
chruetlicommented, May 9, 2021

Thank you!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to edit secured PDFs using Adobe Acrobat
Open the PDF in Acrobat. Select Tools > Protect > Encrypt > Remove Security. Your options vary depending on the type of password...
Read more >
How to Fix “The signature of this program is corrupt or invalid”
Right-click on your program and select Properties. · Click on the Digital Signatures tab. · Select the signature and click on the Details...
Read more >
What is PDF Owner Password and How to Remove Password ...
A PDF owner password is a password that is used to restrict documents in PDF files. In Adobe Acrobat, the owner password is...
Read more >
Signing existing PDF document sometimes causes a corrupt file
The problem is in your program, more exactly in your PdfWorker.Sign method: File.Copy(_source, _dest, true); FileStream f = new ...
Read more >
[Best Practice] How to Lock PDF from Editing?
Select Tools > Protect > Protect Using Password from the drop-down menu. opening the pdf file in acrobat dc pro. Step 2: If...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found