[Solved] Recover a corrupt ods file protected with password

Discuss the spreadsheet application
Post Reply
rahov
Posts: 5
Joined: Mon Oct 06, 2008 9:07 am

[Solved] Recover a corrupt ods file protected with password

Post by rahov »

I'm using OO2.4 on my linux ubuntu box.
I have a spreadsheet file (.ods) that is protected with a password. I've tried to open it as usual but this is what happened:
1. Enter password dialog, I type the correct pass
/now the drama begins/
2. Message appears "The file 'my_file.ods' is corrupt and therefore cannot be opened. Should OpenOffice.org repair the file? "
3. I click yes
4. Error message is shown:
"Read error.
The wrong password has been entered."
5. The file cannot be opened :( :( :(

I have private information in that file so I cannot attach it.
I've seen similar problems here and here with that difference that I do not use SMB, I use only my linux box. I've tried to do that hexedit stuff but I found it irrelevant since I have only one "manifest"

Please, please do help me
Last edited by rahov on Tue Oct 07, 2008 11:38 am, edited 1 time in total.
OOo 2.4.X on Ubuntu 8.x
User avatar
Hagar Delest
Moderator
Posts: 33366
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: How to recover a corrupt ods file protected with a password

Post by Hagar Delest »

Have you tried with the latest RC? The bug seems to have been fixed.
To install the RC, see here: [Ubuntu] Installing OOo on Debian and Co.
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE Faye) and 24.8 portable on Windows 11.
rahov
Posts: 5
Joined: Mon Oct 06, 2008 9:07 am

Re: How to recover a corrupt ods file protected with a password

Post by rahov »

Thanks for the idea!.
But it didn't help :(
I've tried with OpenOffice.org 3.0.0 build:9357 for windows (just copy the file on a USB stick and tried on WindowsXP). The bug is fixed regarding the error at step 4 but nevertheless OO didn't manage to recover the file and said:
"The file could not be repaired and therefore cannot be opened"
OOo 2.4.X on Ubuntu 8.x
User avatar
Hagar Delest
Moderator
Posts: 33366
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: How to recover a corrupt ods file protected with a password

Post by Hagar Delest »

Hmm, in several cases, the Ubuntu version of OOo is mentioned. I'm wondering if it could not come from that. But it will be difficult to check it according to the very few reports.
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE Faye) and 24.8 portable on Windows 11.
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: How to recover a corrupt ods file protected with a password

Post by Villeroy »

A password protected ODF document is an unencrypted zip-archive containing encrypted files, such as content.xml, right?
Append a ".zip" suffix to the file name and load it into your favourite archive tool. If the tool reports that the file is not a zip at all, then all is lost, I'm afraid. If it is a valid zip, then you may extract the files into a distinct directory and try to decrypt the files. At the moment I don't know how to do that, but the encrption algorythm is a well known standard. If you only get content.xml decrypted then you have the raw data and formulas at least.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
rahov
Posts: 5
Joined: Mon Oct 06, 2008 9:07 am

Re: How to recover a corrupt ods file protected with a password

Post by rahov »

Thanks again for the idea with the RC!!!
Finally I managed to recover it :)
The second time I used Windows just because I thought it will be quicker in M$ and because the ubuntu which is on the laptop is not currently with me. The remark regarding the OS in the original post was just to mention that I do not mount or open that file from different places, but use just one distribution.
Now here is how I managed in a mixed mode.
1. Open the file in HexEditor.
2. Delete the manifest.xmlPK - see the screenshot for the selection I've deleted. I've tried 2 different selections to delete and it work in both cases.
Screenshot of the selected region that is deleted by HexEditor (2 cases, both worked for me)
Screenshot of the selected region that is deleted by HexEditor (2 cases, both worked for me)
3. Try to open the file with OO 3.0.0 : it asked for password, it tried to recover the file, it OPENED THE FILE :) !!!!!!!!

Just for information: I've tried to rename the .ods file to .zip, unzip it, delete the manifest.xml (which is under META-INF) than zip it back and rename to .ods again, but it couldn't help

THANKS AGAIN! Sometimes the idea or the very little key information may do the whole job! ;)
OOo 2.4.X on Ubuntu 8.x
rahov
Posts: 5
Joined: Mon Oct 06, 2008 9:07 am

Re: How to recover a corrupt ods file protected with a password

Post by rahov »

Villeroy, thanks also for your suggestion. Since my problem is solved I'll not try it right now but I'will experiment with the decryption when I have time
OOo 2.4.X on Ubuntu 8.x
User avatar
Hagar Delest
Moderator
Posts: 33366
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: How to recover a corrupt ods file protected with a password

Post by Hagar Delest »

Congratulations!
How have you had that idea about the manifest.xmlPK string (and in a hexadecimal text editor)???
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE Faye) and 24.8 portable on Windows 11.
rahov
Posts: 5
Joined: Mon Oct 06, 2008 9:07 am

Re: [Solved] Recover a corrupt ods file protected with password

Post by rahov »

Before posting I've searched the google (the golden rule) and there were such solutions that didn't worked for me. My case was a little bit different.
I've mention those things in the original post:
I've seen similar problems here and here with that difference that I do not use SMB
where here and here are 2 links
(why I didn't use the link itself, knowing that this "here"-link stuff is not very noticeable, nevertheless that it is more pretty !?)
OOo 2.4.X on Ubuntu 8.x
User avatar
Hagar Delest
Moderator
Posts: 33366
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: [Solved] Recover a corrupt ods file protected with password

Post by Hagar Delest »

Indeed! I hadn't read all the the comments, especially that one:
fst wrote:the attached file is corrupted as it contains a doubled entry for the manifest.xml at the end of the file making the central directory of the file useless. How this is created isn't known yet. One thought directs into a not emptied file before saving the streams. This should not be possible with OOo builds but may caused by other builds.

I've repaired the file by simply deleting the last bytes starting at hex 644d with an HexEditor. This may be not the correct position in the file but the result is an document which can be opened using the correct password
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE Faye) and 24.8 portable on Windows 11.
Post Reply