How to decrypt ods file

Zhang, William william.zhang at ptn.advantest.com
Thu Jan 7 01:15:15 PST 2016


Hi Michael,



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.

-odfdom-java-0.8.10-incubation-SNAPSHOT-jar-with-dependencies.jar

-simple-odf-0.8.1-incubation-SNAPSHOT-jar-with-dependencies.jar



ENV: Libreoffice 4.1.4.2 & 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?

Thanks again!



Best Regards

William



-----Original Message-----
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).



http://incubator.apache.org/odftoolkit/odfdom/index.html



see the "password" parameter on the constructor of class org.odftoolkit.odfdom.pkg.OdfPackage
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20160107/ba744263/attachment.html>


More information about the LibreOffice mailing list