Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open a pdf with blank password with pdftk

Tags:

pdftk

We occasionally receive pdf files with blank/empty passwords. We use pdftk and under these circumstances it fails. We have tried:

pdftk input.pdf input_pw  output output.pdf
pdftk input.pdf input_pw \ output output.pdf
pdftk input.pdf input_pw '' output output.pdf
pdftk input.pdf input_pw "" output output.pdf

All fail indicating that we have supplied an incorrect password, however this command works great when the password consists of actual characters. We were hoping that quotes or a \ escaping would trick it, but no love. We found a workaround with qpdf and are going to use that for now, but was hoping someone out there could crack this nut.

like image 684
Bill Butler Avatar asked Mar 28 '16 20:03

Bill Butler


People also ask

How do I password protect a PDF file in Linux?

You can also export an encrypted PDF file from Libre Office (File -> Export as PDF -> Security tab -> Set Passwords -> Set open password), if necessary importing your existing PDF into the Draw program first.


1 Answers

According to this hashcat forums post, the qpdf tool might work for this purpose.

qpdf in.pdf out.pdf --decrypt --password=''

And it looks like you've tried all of the command-line ways to try to pass an empty string to pdftk (and my testing had the same results), so there may be no way to do this with pdftk at all.

like image 124
Royce Williams Avatar answered Oct 04 '22 03:10

Royce Williams