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: RESOLVED FIXED
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 target:7.4.0
Keywords: easyHack, filter:pdf
: 41093 70183 139569 148972 (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: 2024-06-04 07:54 UTC (History)
11 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 (noise)
Comment 3 QA Administrators 2016-09-20 09:24:58 UTC Comment hidden (noise)
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. ***
Comment 8 QA Administrators 2021-01-05 03:47:32 UTC Comment hidden (noise, obsolete)
Comment 9 Timur 2021-01-13 15:53:41 UTC
*** Bug 139569 has been marked as a duplicate of this bug. ***
Comment 10 Timur 2022-05-11 09:33:04 UTC
*** Bug 148972 has been marked as a duplicate of this bug. ***
Comment 11 Xisco Faulí 2022-05-17 19:45:52 UTC
Hi Caolán,
I think you might be interested in this issue since it seems to be related to the UI. If I copy&paste 'μαμα' to the password textfield it doesn't paste anything, however 'mama' works. OTOH, 'μαμα' is pasted to the confirm textbox
Comment 12 Commit Notification 2022-05-18 14:36:16 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/9a474985387fabeed6814e1b69cd2b71a3289020

Related: tdf#50400 restrict "confirm" to same rules as "password"

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Commit Notification 2022-05-19 07:52:14 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/48ecbe9f7b9e324e9acc544c9ad4121d30a232d7

tdf#50400 show an explanatory label if ascii-only password is required

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.