Bug 50400 - PDF export: Warn that password field does not accept Unicode characters other than ASCII (see Comment 6)
Summary: PDF export: Warn that password field does not accept Unicode characters other...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.5.2 release
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: BSA
Keywords: filter:pdf
: 41093 70183 (view as bug list)
Depends on:
Blocks: PDF-Export-Options-Dialog
  Show dependency treegraph
 
Reported: 2012-05-27 11:23 UTC by C.Siedentop
Modified: 2019-01-05 12:48 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample document to be exported with password containing Unicode characters (24.72 KB, application/vnd.oasis.opendocument.text)
2012-05-27 11:23 UTC, C.Siedentop
Details

Note You need to log in before you can comment on or make changes to this bug.
Description C.Siedentop 2012-05-27 11:23:17 UTC
Created attachment 62145 [details]
Sample document to be exported with password containing Unicode characters

Problem description: 
A text document can't be exported to PDF, when the password should contain Unicode characters, for example Greek.

Steps to reproduce:
1. 
Set the language of the keybord to „Greek“. You can verify this typing 'μαμα' (english 'mama' without space).
2. 
Start to export this document to PDF with password.
user password:  μαμα  (mama)
3.
When you try to enter the user password into the first field, you can't. But you can enter it into the confirmation field.

Current behavior:
You can't export the document.

Expected behavior:
A document should be exported with a password containing Unicode.

Platform (if different from the browser): 
Windows 7
LibreOffice 3.5.2.2
Comment 1 bfoman (inactive) 2012-11-27 18:51:39 UTC
Confirmed with:
LO 3.6.4.1
Build ID: a9a0717
Windows XP Professional SP3

You cannot insert such characters into first field (even when using Special character available via right click option), but inserting into second one seems to work (at least asterisks are visible).
Comment 2 QA Administrators 2015-04-19 03:23:47 UTC Comment hidden (obsolete)
Comment 3 QA Administrators 2016-09-20 09:24:58 UTC Comment hidden (obsolete)
Comment 4 Michael Weghorn 2018-06-29 07:32:52 UTC
The restriction to ASCII-only characters comes from the following commit, so it seems to have been added intentionally:

commit 38b37dca86af9e61ee753caf6d7b3eab511d012c
Author: Philipp Lohmann <Philipp.Lohmann@Sun.COM>
Date:   Fri Oct 23 13:26:54 2009 +0200

    #i90373# allow only ascii characters in PDF passwords

diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 1854a37184cb..4037ba0560a8 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -1174,6 +1174,7 @@ void ImpPDFTabSecurityPage::ImplPwdPushButton( const String & i_rDlgTitle, Strin
     aPwdDialog.SetMinLen( 0 );
     aPwdDialog.ShowExtras( SHOWEXTRAS_CONFIRM );
     aPwdDialog.SetText( i_rDlgTitle );
+    aPwdDialog.AllowAsciiOnly();
     if( aPwdDialog.Execute() == RET_OK )  //OK issued get password and set it
         io_rDestPassword = aPwdDialog.GetPassword();
     enablePermissionControls();
Comment 5 Timur 2018-08-01 16:19:32 UTC
*** Bug 70183 has been marked as a duplicate of this bug. ***
Comment 6 Timur 2018-08-01 16:21:36 UTC
https://bugs.documentfoundation.org/show_bug.cgi?id=70183#c12
Mike Kaganski 2017-07-08 18:54:42 UTC

The relevant information from Adobe is here:
https://forums.adobe.com/thread/831473
https://forums.adobe.com/thread/489152

So, the algorithm used by LibreOffice could in theory allow using any characters, but they would need to be converted to system 8-bit codepage (different for Win and Mac) before using for encryption. Thus, a PDF encrypted with non-ASCII characters would be ~impossible to open on any system with different system locale. Thus, using the ASCII restriction is a good choice.

I tested that encoding the password as utf-8 makes the PDF unopenablw using Adobe Acrobat Reader DC 2017.

The problem here remains only to make this user-visible and documented.
As the easiest solution for those who would like to implement this (as an easyhack), I'd propose to add to the SfxPasswordDialog a (yellow?) label saying something like "Only English letters, numbers other ASCII characters", which were hidden by default, and were made visible in the SfxPasswordDialog::AllowAsciiOnly().
Comment 7 Harald Koester 2018-09-17 18:43:26 UTC
*** Bug 41093 has been marked as a duplicate of this bug. ***