[Solved] Lost password for protected ODT file

Discuss setup / installation issues - Add a spell checker, Language pack?
Post Reply
Bill.1965
Posts: 1
Joined: Thu Jun 03, 2021 5:21 pm

[Solved] Lost password for protected ODT file

Post by Bill.1965 »

Running Open Office 4.1.7 on Windows 10. The passcode which I believe to be the proper password for this file for years no longer works. I cannot recall making a change to the password, but it's possible. Is there a way for me to recover the content of this important file?
Last edited by Bill.1965 on Fri Jun 04, 2021 4:12 pm, edited 1 time in total.
Open Office 4.1.7
Windows 10
User avatar
robleyd
Moderator
Posts: 5036
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Lost password for protected ODT file

Post by robleyd »

This question comes up here from time to time; see for example Unable to open p/word protected file anymore

A forum search for lost password will return some other related topics; but the short answer is that the password protection is effectively unbreakable.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.1.2; SlackBuild for 24.2.1 by Eric Hameleers
giuvi
Posts: 27
Joined: Sun Dec 21, 2008 12:29 am

Re: Lost password for protected ODT file

Post by giuvi »

robleyd wrote:This question comes up here from time to time; see for example Unable to open p/word protected file anymore

A forum search for lost password will return some other related topics; but the short answer is that the password protection is effectively unbreakable.
I red quite all the topics related with lost password ... it is very hard to break it, but I think, in the last years we have learnt enough, that there is no unbreakable password ... at last it's depend on, how long the password is and how much worth is the protected file for the owner.

Anyway I have a similar problem with an ODS file.
It is possible (I don't remember anymore), I've changed the protect password, the last time I opened it, about a year ago. But maybe I didn't change the password at all and the file (or OO 4.1.7 under Linux) is corrupted.

And maybe I have a lot of backups of the protected file as well as the #~.openoffice/ directory.
So if I recover an old version of this file (= with the old password) I should open it.
But at first: where are saved passwords for OO documents? In the document-file or in a OO configuration directory?

Thank for any suggestion
User avatar
RoryOF
Moderator
Posts: 34570
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Solved Lost password for protected ODT file

Post by RoryOF »

I suspect they are encrypted into the file, as if they were saved in plain text with a "This is the password" flag they could be easily recovered, as can or used be possible with MS Word files.

As far as I know a form of AES encryption is used. You might investigate the OpenOffice source code, which is available for download, to find how the encryption is carried out.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
John_Ha
Volunteer
Posts: 9583
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Solved Lost password for protected ODT file

Post by John_Ha »

The password is not saved in the file.

The contents of the file are hashed using the password and the hashed content is saved. The password is needed to un-hash the content.

Search for an earlier post of mine which describes exactly how this happens.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
giuvi
Posts: 27
Joined: Sun Dec 21, 2008 12:29 am

Re: Solved Lost password for protected ODT file

Post by giuvi »

RoryOF wrote:I suspect they are encrypted into the file, as if they were saved in plain text with a "This is the password" flag they could be easily recovered, as can or used be possible with MS Word files.

As far as I know a form of AES encryption is used. You might investigate the OpenOffice source code, which is available for download, to find how the encryption is carried out.
John_Ha wrote:The password is not saved in the file.

The contents of the file are hashed using the password and the hashed content is saved. The password is needed to un-hash the content.

Search for an earlier post of mine which describes exactly how this happens.
RoryOF, John_Ha, thanks for you contribution.
In actual fact I don't intend to brake the password protection of OO. So I won't immerse myself in source code or in hash items. And I would be not be able with my current knowledge level!

As RoryOF I also suppose, the password are encrypted and saved in the protected file. If it were different, it would be not possible to open it on another environment.
But if there is no certainty about the place, where OO saves passwords, I have simply to test opening the old files using the known old password.
AOO 4.1.13 on OpenSUSE Leap 15.4
John_Ha
Volunteer
Posts: 9583
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: [Solved] Lost password for protected ODT file

Post by John_Ha »

giuvi wrote:But if there is no certainty about the place, where OO saves passwords, I have simply to test opening the old files using the known old password.
Correct. The password is not saved in the file.

A grossly oversimplified explanation. I want to encrypt the number 1,234,567,890 using the password 8641. Say my encryption method is simply to multiply (hash) the plaintext by (password - salt_number). So, I generate a random number as the salt - say it is 17. I subtract 17 from the 8641 password you choose to get 8,624. I multiply 1,234,567,890 by 8,624 to get 10,646,913,483,360 as my encrypted text. AOO generates a different salt for each sub-file in the document so, although only one user_password is used, each sub-document is encrypted with a different "password". The salt(s) 17 is/are stored in the file.

To decrypt, I ask for the password and you enter 8641. I read the salt 17 from the file, and subtract the 17 to get 8,624. I divide the encryption 10,646,913,483,360 by 8,624 to get the plain text 1,234,567,890.

Note how the 8,624 8641 is not stored anywhere.

See Unable to open p/word protected file any more for
  • a discussion of how passwords work in AOO,
  • some web sites which offer to recover files by creating variants of the password(s) you supply, and
  • a spreadsheet macro which reads lists of possible passwords you create and tries each variant.
.
Last edited by John_Ha on Fri Jun 11, 2021 10:09 am, edited 1 time in total.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
giuvi
Posts: 27
Joined: Sun Dec 21, 2008 12:29 am

Re: [Solved] Lost password for protected ODT file

Post by giuvi »

John_Ha wrote:Correct. The password is not saved in the file.

A grossly oversimplified explanation. I want to encrypt the number 1,234,567,890 using the password 8641. Say my encryption method is simply (...)
... AOO generates a different salt for each sub-file in the document so, although only one user_password is used, each sub-document is encrypted with a different "password". The salt(s) 17 is/are stored in the file.

To decrypt, I ask for the password and you enter 8641. I read the salt 17 from the file, and subtract the 17 to get 8,624. I divide the encryption 10,646,913,483,360 by 8,624 to get the plain text 1,234,567,890.

Note how the 8,624 is not stored anywhere.
I think, I've understood. In the file only the "random salts" are saved, a kind of key, which permits the encryption algorithm to verify, if the password put in is correct.
This implies, the encryption algorithm of AOO and LO are the same. It is also possible to open a protected AOO file with MS-Office?

Now back on my problem (not possible opening an AOO-ods file with AOO-Calc)
a) at the first, I thought, I've forgotten the password or I had changed it, the last time I used the file.
b) today I restored from backups many old versions of this files since 2014. Particularly interesting is the file of 2014: its password is very simple (like 1234). No chance to open one of these files - AOO notified every time the password were wrong!
c) at last I installed LO and with it, I can now open the protected files - the old as well the new ones. I didn't forget the passwords!

What is actually wrong with AOO [A00417m1 (Build:9800) - Rev. 46059c9192] ?
- maybe a compaytibility problem with Linux (this does not support AOO anymore) ?
- or could be that an AOO component has been corrupted?
- should I try a reinstall of AOO?
John_Ha
Volunteer
Posts: 9583
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: [Solved] Lost password for protected ODT file

Post by John_Ha »

I am very surprised you see a difference between AOO and LO as all .od* files use the same encryption method. It's part of the ODF standard so AOO and LO do exactly the same.

Type the password into Notepad and copy and paste it into the password box to guarantee you don't make a typo. If it is still different it suggests a bug in AOO.

Do some diagnostics. Download an earlier release of AOO from https://www.openoffice.org/download/ and create a password protected file. Does it open with 4.1.7?

Searching AOO bugzilla with password gets lots of hits. Issue 121086 - AOO 3.4.0 cannot open OOo3.3 password protected spreadsheet relates to very old software, namely AOO 3.4 in 2012 - the last post is 2014. The poster said LO was able to open the file(s) so trying LO seems sensible.

AOO runs and is supported under Linux.

Try starting the PC in Safe Mode where you don't start any of the user_start_up programs. If it now works OK it is a startup program interfering.

Start using the AutoType function in KeePass or Password Safe. Both fill in user_name and/or password as required.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
giuvi
Posts: 27
Joined: Sun Dec 21, 2008 12:29 am

Re: [Solved] Lost password for protected ODT file

Post by giuvi »

John_Ha wrote:I am very surprised you see a difference between AOO and LO as all .od* files use the same encryption method. It's part of the ODF standard so AOO and LO do exactly the same.

Type the password into Notepad and copy and paste it into the password box to guarantee you don't make a typo. If it is still different it suggests a bug in AOO.
I did it, even if it was unnecessary, because in the last two days I tried the password at least one hundred times.
Results as expected: false password warning.
John_Ha wrote:Do some diagnostics. Download an earlier release of AOO from https://www.openoffice.org/download/ and create a password protected file. Does it open with 4.1.7?
I had already the 4.1.7 version. So I installed the 4.1.6 one, because it was already on the hard disk.
What a mistake ... I had forgotten, with this version I had the problem, that AOO is not able to search and find JRE in operative system. Nor it is able to process the password correctly and give the same warning message.
At last I found, there is a new AOO version- the 4.1.10. After installed this and checked, that it can find JRE, I tried to open the protected file - successfully!
I suppose, 4.1.7 was not able to process the password correctly because a JRE issue. Maybe I chose the false JRE, when I installed it about 2 years ago.

John_Ha wrote:AOO runs and is supported under Linux.
More precise: AOO runs under Linux but it is NOT supported.
I have been using AOO under OpenSUSE for more then 10 years and since the LO-fork became established, quite all Linux distributions detracted the support to AOO gradually.
Since about 5 years users get a warning messages on installing AOO on OpenSuse and you could experience "renitency" in Suse Forums with items related to AOO.

John_Ha, thanks a lot for your support!
AOO 4.1.13 on OpenSUSE Leap 15.4
John_Ha
Volunteer
Posts: 9583
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: [Solved] Lost password for protected ODT file

Post by John_Ha »

giuvi wrote:I suppose, 4.1.7 was not able to process the password correctly because a JRE issue. Maybe I chose the false JRE, when I installed it about 2 years ago.
 Edit: Java is not required to process password protected files.

However, if you need Java for other things ... 
You must have 32-bit Java installed for AOO. In Windows, it's the version not marked 64-bit. It installs successfully for every version of AOO.

LO uses 64-bit Java.

You can have both 32- and 64-bit Java installed.

See Troubleshooting Open/LibreOffice and Java
java.png
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Post Reply