Properties not displayed for Protected PDFs

It seems you're using an AdBlocker or JavaScript is disabled!

This sites offers only FREE software and it's supported by a few advertisement boxes (no intrusive popups).

This 10 seconds wait is to let you update your AdBlocker whitelist...

Got it, show me the content...
Please enable JavaScript!
Posts: 5
Joined: March 14, 2020 - 16:18
Properties not displayed for Protected PDFs

Hello,
thank you for providing this useful tool!
It works fine for usual PDFs, but there ist a problem with PDFs which are write-protected by a password.
I created these PDFs with OpenOffice from text documents and entered a password for the access rights to prevent changes. Then every property I set is displayed in the Windows-Explorer (Win10) as "þÿ" (which is the UTF-16 BE BOM).

Interesting is, that the Adobe Reader is able to display the correct properties without requesting the password.
But it says (Properties / Security), that the complete content is encrypted, and search engines cannot read the metadata.
If the Adobe Reader is capable of getting the properties, perhaps you can do this, too?

Thank you and have a nice day,
Fred

Posts: 1648
Joined: March 25, 2012 - 01:19
Re: Properties not displayed for Protected PDFs

Please post a sample PDF document here to reproduce the issue (the smaller the better, no sensitive data, ZIP compressed).

This way I'm sure to work on the right file and, also, if I can fix it we'll have an "official" test file ;)

Posts: 5
Joined: March 14, 2020 - 16:18
Re: Properties not displayed for Protected PDFs

Hello,

thank you for your reply. I had problems to login and sent you some test files via the contact form.

I think the problem is easy to solve: The metadata is UTF-16 BE encoded in these cases. If you see the BOM at the start of the string, just decode the following 16 bit BE chars.

Here is annother file, which will make this clear: I entered Euro signs  for metadata title, keywords ...

As Euro is Unicode 0x20AC, you will see in the Explorer a space followed by a logic not sign for each €.

Have a nice day and keep healthy,

Fred

Attachments (Only registered users)
PDFTestEuro.zip
Posts: 1648
Joined: March 25, 2012 - 01:19
Re: Properties not displayed for Protected PDFs
FredJ wrote:
I think the problem is easy to solve

No, it's not ;)
The four '€' chars  in Title property are stored liks this in the encrypted PDF file

0x99AB4704EEF4CCCCC050 <-- (offset 0x5FD0 in your pdf file)

This is the encrypted version of the "€€€€" title string.
Decrypting it requires a lot of work, starting from reading owner password from Encrypt dictionary, reversing it then applying to all of the strings in the file.

Will have a look, but it's not a simple UTF-16/Encoding issue...

Posts: 5
Joined: March 14, 2020 - 16:18
Re: Properties not displayed for Protected PDFs

Hello!

You wrote:

Decrypting it requires a lot of work, starting from reading owner password
from Encrypt dictionary, reversing it then applying to all of the strings in
the file.

Yes. I did not mean, that *decrypting* is easy.
Your extension is doing this fine, also with these testfiles!

By the way, where did you get the information how to do this?

Looking at the strings of the last testfile displayed in the Explorer, I see that they are decoded correctly.
But they are displayed byte by byte as if they were ANSI, including the BOM. It seems that the program does not expect UTF-16 BE.
If a string uses ASCII chars only, the next byte after the BOM is always 0 with BE. So only the BOM is displayed.

So what I think is easy, is to look for a BOM, remove it and convert the string to UTF-16 LE (Windows Unicode).

Thank you,
Fred

Posts: 1648
Joined: March 25, 2012 - 01:19
Re: Properties not displayed for Protected PDFs

Well, it was easier than I thought (and you were partially right ;))

PDF encrypted objects support was already added back in v.1.10.0, but limited to unencoded ANSI strings, due to limitations in an internal class.
I've extended UTF support to all of the PDF objects, being them encrypted or not... ;)

Just released version 1.14.0 with the new feature added.

Thanks for your detailed report; it helped me a lot to fix the issue quickly.

Cheeers

Posts: 5
Joined: March 14, 2020 - 16:18
Re: Properties not displayed for Protected PDFs

Hello,

just installed the new version. Works with all my PDFs.

May I ask, where did you get the information how to do the decryption?

Mille grazie!

Fred

Posts: 1648
Joined: March 25, 2012 - 01:19
Re: Properties not displayed for Protected PDFs

I've used the official PDF reference documentation available from Adobe website:
https://www.adobe.com/devnet/pdf/pdf_reference.html

And a great help came from Stackoverflow.com ;)

Posts: 5
Joined: March 14, 2020 - 16:18
Re: Properties not displayed for Protected PDFs

Hello,
thank you for your interesting reply and for the update in such a short time!
Buona serata,
Fred