Page 1 of 1
[Solved] Recover a corrupt ods file protected with password
Posted: Mon Oct 06, 2008 9:42 am
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
Re: How to recover a corrupt ods file protected with a password
Posted: Mon Oct 06, 2008 10:54 am
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.
Re: How to recover a corrupt ods file protected with a password
Posted: Tue Oct 07, 2008 10:33 am
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"
Re: How to recover a corrupt ods file protected with a password
Posted: Tue Oct 07, 2008 10:57 am
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.
Re: How to recover a corrupt ods file protected with a password
Posted: Tue Oct 07, 2008 11:15 am
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.
Re: How to recover a corrupt ods file protected with a password
Posted: Tue Oct 07, 2008 11:33 am
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)
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!

Re: How to recover a corrupt ods file protected with a password
Posted: Tue Oct 07, 2008 11:37 am
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
Re: How to recover a corrupt ods file protected with a password
Posted: Tue Oct 07, 2008 11:41 am
by Hagar Delest
Congratulations!
How have you had that idea about the manifest.xmlPK string (and in a hexadecimal text editor)???
Re: [Solved] Recover a corrupt ods file protected with password
Posted: Tue Oct 07, 2008 11:59 am
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 !?)
Re: [Solved] Recover a corrupt ods file protected with password
Posted: Tue Oct 07, 2008 12:58 pm
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