Issue 90373 - pdf generated with unicode password could not be opened
Summary: pdf generated with unicode password could not be opened
Status: CLOSED FIXED
Alias: None
Product: gsl
Classification: Code
Component: code (show other issues)
Version: OOo 3.0 Beta
Hardware: Unknown All
: P3 Trivial (vote)
Target Milestone: OOo 3.3
Assignee: h.ilter
QA Contact: issues@gsl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-04 16:53 UTC by intersol
Modified: 2017-05-20 10:29 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
PDF with a non-ascii password "Ä…Äęėįšųūž" (6.02 KB, application/pdf)
2009-10-22 15:59 UTC, rq
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description intersol 2008-06-04 16:53:17 UTC
The exported PDF files protected with unicode passwords could not be opened.
Tested with two readers: Adobe Reader 9.0 and Foxit Reader 2.6 on Windows.

Password for testing: ěšÄřžýáíé (9 characters)
Comment 1 philipp.lohmann 2008-06-06 09:40:48 UTC
Known problem, the problem is that in the PDF reference there is no encoding for
the password specified, only that it should be paded to 32 bytes. The only thing
that we know to work is ansi1252 (or respectively iso8859-1), therefore the
password is converted to that encoding. Meaning your string afterwards probably
was "?????????" since unconvertible characters are replaced by '?'.

To solve this problem we need to find out which encoding acrobat reader would
accept.
Comment 2 rq 2009-10-21 21:19:45 UTC
Could we simply limit password characters to ASCII until we know the encoding?
Comment 3 philipp.lohmann 2009-10-22 09:45:35 UTC
That is effectively happening; the password is converted to ansi1252 encoding
(aka iso8859-1). Limiting the entry at the dialog would indeed be preferable,
alas this is currently not possible since that is a general purpose dialog used
for passwords everywhere.
Comment 4 rq 2009-10-22 15:59:44 UTC
Created attachment 65539 [details]
PDF with a non-ascii password "Ä…Äęėįšųūž"
Comment 5 rq 2009-10-22 16:01:44 UTC
Attached above is a PDF file with password "Ä…Äęėįšųūž" set using Adobe Acobat
software. Perhaps it's possible to reverse engineer the encoding scheme used for it?
Comment 6 philipp.lohmann 2009-10-22 16:43:12 UTC
My acrobat reader (mac, 9.2.0) doesn't even open the attached file with that
password. So I guess that unicode passwords indeed are rather undefined.
Comment 7 rq 2009-10-22 16:51:41 UTC
->pl: I hope you entered the password without quote characters?

It works on Windows for me. I'm downloading Linux version right now to check on
it too.

BTW, if I export a PDF from OpenOffice, and use password "Ä…Äęėįšųūž", I cannot
open it with Reader even if I enter "?????š??ž". So, the current scheme seems to
be really buggy to me.

If it's impossible to limit characters from within the dialog box, then perhaps
it's possible to trigger an error dialog if the password contains non-ascii
characters?
Comment 8 philipp.lohmann 2009-10-22 16:56:35 UTC
No, I didn't copy the quotes
Comment 9 rq 2009-10-22 17:05:49 UTC
Funny. The Reader on Linux doesn't allow me to enter any of those characters
except "ž" and crashes right away if I submit a password containing this letter.
:) BUT ONLY IF I'M USING KEYBOARD TO ENTER IT! If I paste the password instead,
it says the password is incorrect, just like it does to you, and does not crash.


->pl I really can't believe that it's impossible to check input while it's being
entered (onChange) and act accordingly. But if it really is, then OOo should at
least check the password before saving the PDF, and if the password contains
anything but ASCII (or windows-1252), OOo should return to the same dialog
instead of saving.
Comment 10 philipp.lohmann 2009-10-22 17:17:45 UTC
The latest Adobe supplement to the PDF reference at least specifies that the
password should be converted to PDFDocEncoding. Which is only partially helpful
since PDFDocEncoding is a single byte encoding, also, so the conversion problems
remain.

Oh well. I guess the optimal solution would indeed be to modify
SfxPasswordDialog (which is used to enter the password) so it does not accept
non ascii input.
Comment 11 rq 2009-10-22 17:54:35 UTC
Would the modification of SfxPasswordDialog only affect PDF export or something
else too? 
Comment 12 philipp.lohmann 2009-10-23 12:28:33 UTC
SfxPasswordDialog can now optionally forbid non-Ascii characters. Since it seems
that even Adobe cannot reliably work with non-Ascii passwords, it seems best to
forbid them while entering.

Fixed in CWS vcl106
Comment 13 rq 2009-10-24 18:43:51 UTC
->pl Could this be backported to 3.2?
Comment 14 philipp.lohmann 2009-10-26 11:00:31 UTC
Technically no problem. However you would have to convince
releases@openoffice.org that this is a showstopper.
Comment 15 philipp.lohmann 2009-10-26 12:28:21 UTC
please verify in CWS vcl106
Comment 16 h.ilter 2009-10-30 12:58:04 UTC
Verified with cws vcl106 = OK; Non-Ascii characters are forbidden now.