tsboh / origami-pdf

Automatically exported from code.google.com/p/origami-pdf
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Can't decrypt file because of wrong padding #19

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. pdf = Origami::PDF.read('144swan.pdf')
2. pdf.decrypt

I get: Origami::EncryptionError: Data must be 16-bytes padded (data size = 5 
bytes)

What is the expected output? What do you see instead?

I expect the file to be decrypted, as it works fine with qpdf.

What version of the product are you using? On what operating system?

1.2.5, OS X 10.8

Any hints?

Original issue reported on code.google.com by j...@theberlin6.com on 5 Mar 2013 at 9:03

Attachments:

GoogleCodeExporter commented 8 years ago
Hello,

when you call PDF.read(), Origami automatically detects that the document is 
encrypted and tries to decrypt it with a blank password (or with the password 
passed through the :password switch of the read method).

So the document was actually already decrypted and readable. The call to 
decrypt is actually almost never necessary (maybe I should set it as private). 
In that case, Origami was trying to decrypt the already decrypted data.

I added a check so that doesn't happen again in the future. But you can remove 
the call to PDF#decrypt on your side.

Guillaume

Original comment by guilla...@security-labs.org on 8 Apr 2013 at 8:59