How to decrypt ods file
william.zhang at ptn.advantest.com
Thu Jan 7 01:15:15 PST 2016
Thanks a lot for your hint!
But I still got some problems. With your suggestion, I used these two jars which looks like the new version.
ENV: Libreoffice 220.127.116.11 & Libreoffice 3.x / java 1.7
1. Open a .ods file manually, save it with password.
2. In code, execute “SpreadsheetDocument.loadDocument(File file, String password)”, it always throw NullPointer Exception.
->After checking the source code, the code in ZipHelper.line87: System.getProperty(“Java.version”).equals(…) in try/catch will throw NullPointer.
->Obviously the parameter here should use “java.version” instead, but the code in line83: inputStream.getNextEntry() always throw java.util.zip.ZipException: only DEFLATED entries can have EXT descriptor, which is the key reason.
Then I tried API to load a unencrypted .ods file and save it with password with code org.odftoolkit.simple.Document.save(File file, String pasword). In this case, I can load the encrypted file with code.
Based on this situation, I don’t know if you tried with this API before. And do you have some more information?
From: Michael Stahl [mailto:mstahl at redhat.com]
Sent: 2016年1月5日 0:39
To: Zhang, William; libreoffice at lists.freedesktop.org
Subject: Re: How to decrypt ods file
On 25.12.2015 06:08, Zhang, William wrote:
> Does anyone know how to decrypt an encrypted Libreoffice Calc file
> with Java or other languages? Or even some workarounds. Thanks a lot!
the Apache ODF Toolkit ODFDOM library supports ODF encryption, at least with the "old" Blowfish/SHA1 algorithms that were used in LO <= 3.5 (i'm not aware if anybody has added support for AES, which is used since LO 3.5).
see the "password" parameter on the constructor of class org.odftoolkit.odfdom.pkg.OdfPackage
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the LibreOffice