Bug 65492 - Opening Password for DOC / XLS file limited to 15 characters (obsolete MSO limit - focus on comment 9)
Summary: Opening Password for DOC / XLS file limited to 15 characters (obsolete MSO li...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: BSA
Keywords:
: 131313 (view as bug list)
Depends on:
Blocks: DOC Password-Protected XLS
  Show dependency treegraph
 
Reported: 2013-06-07 06:26 UTC by hp.web
Modified: 2020-06-23 17:00 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
A .DOC encrypted with 30-character password "123456789012345678901234567890" (21.50 KB, application/msword)
2019-03-29 06:20 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hp.web 2013-06-07 06:26:33 UTC
Problem description: When I save the document in MS-Word 97-Format and encrypt it with the Phrase "Herr, deine Liebe", it is not possible to open in neither in Word nor in LibreOffice

Steps to reproduce:
1. Create a Text-Document
2. Save it in  MS-Word 97-Format, choosing, encrypt, giving twice the Password: Herr, deine Liebe
3. Try to open it, give above Phrase as the password

Current behavior: Errormessage: Password is wrong, file can't be opened.

Expected behavior:Open the document. (Or at least give a warning, when I save the file, that the document can't be restored.

              
Operating System: Windows XP
Version: 4.0.3.3 release
Comment 1 hp.web 2013-06-07 06:30:02 UTC
One further note: When I used "test13" as a password or when I saved the file using odf-Format everything worked just fine.
Comment 2 hp.web 2013-06-07 06:31:31 UTC
And if I saved the file as docx, without warning it opened without any password at all.
Comment 3 ign_christian 2013-06-07 10:14:26 UTC
> Problem description: When I save the document in MS-Word 97-Format and
> encrypt it with the Phrase "Herr, deine Liebe", it is not possible to open
> in neither in Word nor in LibreOffice

Did you mean the password is: Herr, deine Liebe ?
If yes, it's not possible because too many characters. 
We can only entry: Herr, deine Lie

LO 4.0.4.1 (Win7 32bit)
Comment 4 hp.web 2013-06-07 20:43:59 UTC
Yes, that was the password. It probably would help, if the dialogue would give 
a hint, how many charakters the password could have.

Thanks a lot for your work. I really appreciate LibreOffice.

Hanno

Am Freitag, 7. Juni 2013 schrieben Sie:
> https://bugs.freedesktop.org/show_bug.cgi?id=65492
> 
> ign_christian <ign_christian@yahoo.com> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|UNCONFIRMED                 |NEEDINFO
>                  CC|                            |ign_christian@yahoo.com
>      Ever confirmed|0                           |1
> 
> --- Comment #3 from ign_christian <ign_christian@yahoo.com> ---
> > Problem description: When I save the document in MS-Word 97-Format and
> > encrypt it with the Phrase "Herr, deine Liebe", it is not possible to open
> > in neither in Word nor in LibreOffice
> 
> Did you mean the password is: Herr, deine Liebe ?
> If yes, it's not possible because too many characters. 
> We can only entry: Herr, deine Lie
> 
> LO 4.0.4.1 (Win7 32bit)
> 
> -- 
> You are receiving this mail because:
> You reported the bug.
>
Comment 5 ign_christian 2013-06-08 03:41:41 UTC
So marking NEW enhancement, similar case with XLS file on Bug 43452

Password for open file when saving as DOC limited to 15 characters.
Don't know from developer side whether it's possible or at least should be a hint dialogue box as presented on comment 4.
Comment 6 A (Andy) 2015-03-07 15:43:21 UTC
This bug is no longer reproducible with LO 4.4.1.2, Win 8.1:

Saving as odt file:
Longer passwords are now possible.

Saving as doc/docx file:
Message occurs: "The inserted text exceeded the maximum length of this text field. The text was truncated."


Can anybody else reproduce it or can we close it as Resolved?
Comment 7 Mike 2018-07-01 08:04:36 UTC
LO can still only open DOCs, which password is 15 characters max. 

But Word 2013 has the same limit, so LO is compatible to MS Office 2013.(Though, I tested the limit with MS Word 2007. It supports longer passwords. So, if you have to open an old DOC with a longer password, you need an older version of MS Office.)
Comment 8 Mike Kaganski 2019-03-29 05:05:42 UTC
(In reply to Mike from comment #7)
> Though, I tested the limit with MS Word 2007. It supports longer
> passwords. So, if you have to open an old DOC with a longer password, you
> need an older version of MS Office.

Just tested with Word 2007 (12.0.6784.5000) SP3: created a new document, saved as DOC, and set its encryption password to 16-character "1234567890123456". It swallowed the password (although asked me if I want to use DOCX instead because of stronger encryption), and then trying to open the document using the same 16-character password failed, while entering the first 15 characters allowed me to successfully open the document.

So was there actually a version that allowed to use more than 15 characters of password for binary documents? Should the bug be closed NOTABUG (or concentrate on proper indication of limiting entered password - something the person entering the password might not notice), or set to NEEDINFO asking for a sample of (or specific steps to get) such a document?
Comment 9 Mike Kaganski 2019-03-29 06:20:20 UTC
Created attachment 150386 [details]
A .DOC encrypted with 30-character password "123456789012345678901234567890"

(In reply to Mike Kaganski from comment #8)

I was able to reproduce the problem, even using Word 2016: setting an arbitrary-length password to a DOCX, and then re-saving it as DOC, keeps the long password.
Comment 10 eisa01 2020-05-02 16:24:51 UTC
See the spec, section 20 for more info. MSO up to 2003 only supported 15 characters, but 2007 and 2010 supported longer up to 255. Applies to XLS, but assume it's the same for DOC

https://docs.microsoft.com/en-us/openspecs/office_file_formats/ms-xls/a3ad4e36-ab66-426c-ba91-b84433312068

LO 3.3 exhibits the same behavior, can only save with 15 characters, so assume this is inherited
Comment 11 Justin L 2020-06-20 13:39:56 UTC
(In reply to hp.web from comment #4)
> It probably would help, if the dialogue would give a hint,
> how many characters the password could have.
The typing hint (during save) exists now in LO 7.0 thanks to bug 43452.


The open dialog itself does not (and should not) limit the characters to 15. However, I could not open an xls file with a 16 character password created by Excel 2016.

The code that handles the password checking for xls seems to be in comphelper/source/misc/docpasswordhelper.cxx
DocPasswordHelper::requestAndVerifyDocPassword()


I also am not able to open Mike's document from comment 9 in LO.

The code that handles the password checking for doc seems to be in sw/source/filter/ww8/ww8par.cxx
Init97Codec()
Comment 12 Justin L 2020-06-20 16:05:37 UTC
Sample code that allows copy/pasters to open XLS files with a too-long password. https://gerrit.libreoffice.org/c/core/+/96777
Comment 13 Justin L 2020-06-22 14:48:21 UTC
Sample code that allows copy/pasters to open DOC files when typing or pasting a password larger than the maximum length.
https://gerrit.libreoffice.org/c/core/+/96868
Comment 14 Justin L 2020-06-23 08:30:33 UTC
Providing support for longer than 15 character passwords probably requires a fairly major overhaul. (For .doc I could extend that to 16 characters just by
-            if ( nLen <= 15 )
+            if ( nLen <= 16 )
in Init97Codec, but higher numbers didn't work, probably because "16" is hardcoded all over the place in filter/source/msfilter/mscodec.cxx.

This is not an area I should be contributing to anyway, so that's as far as I will investigate.
Comment 15 Justin L 2020-06-23 17:00:13 UTC
*** Bug 131313 has been marked as a duplicate of this bug. ***