How to decrypt ods file

Zhang, William william.zhang at
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.



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


-----Original Message-----
From: Michael Stahl [mailto:mstahl at]
Sent: 2016年1月5日 0:39
To: Zhang, William; libreoffice at
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...
URL: <>

More information about the LibreOffice mailing list