umya-spreadsheet icon indicating copy to clipboard operation
umya-spreadsheet copied to clipboard

encrypt xlsx file can not open by wps-office

Open flyInRust opened this issue 2 years ago • 6 comments

after use writer::xlsx::write_with_password to encrypt some xlsx file,the wps-office can't open this file .

flyInRust avatar Apr 09 '23 05:04 flyInRust

and libreoffice can't open the encrypt( writer::xlsx::write_with_password) file too!

flyInRust avatar Apr 10 '23 01:04 flyInRust

@flyInRust Thank you for your report. I can confirm that libreoffice does not open encrypted files. It probably means that there are parts of the specifications regarding encryption that differ from software to software. It would be difficult to identify the part to be fixed, so it would take some time to modify the program.

MathNya avatar Apr 10 '23 07:04 MathNya

can u port the function from the msoffice-crypt ?

flyInRust avatar Apr 10 '23 09:04 flyInRust

i have create a msoffice-crypt rust bind:

msoffice crypt rust

use msoffice_crypt::{encrypt,decrypt};
fn main() {
        let input = "/home/feiy/Desktop/1.xlsx";
        let output = "/home/feiy/Desktop/output.xlsx";
        let password = "test";
        let ret = encrypt(input,password,Some(output));
        println!("{ret:#?}");
        let plain = "/home/feiy/Desktop/plain.xlsx";
        let ret = decrypt(output,password,Some(plain));
        println!("{ret:#?}");
        let plain = "/home/feiy/Desktop/plain.xlsx";
        let ret = encrypt(plain,password,None);
        println!("{ret:#?}");
        
}

flyInRust avatar Apr 10 '23 16:04 flyInRust

@flyInRust Thank you very much. I have looked at msoffice crypt rust. It is a wonderful library.

However, umya-spreadsheet cannot use this library because it must be 100% rust language.

I will refer to it to find the cause of the problem.

MathNya avatar Apr 11 '23 00:04 MathNya

this is the encrypt References: * Compound File Binary File Format(v20120328) MS-CFB * Office Document Cryptography Structure Specification(v20120412) MS-OFFCRYPTO * CODE BLUE 2015 Backdoors with the MS Office file encryption master key and a proposal for a reliable file format

flyInRust avatar Apr 11 '23 02:04 flyInRust