https://bugs.documentfoundation.org/show_bug.cgi?id=166241

            Bug ID: 166241
           Summary: A specific encrypted XLSX can't be opened
           Product: LibreOffice
           Version: unspecified
          Hardware: All
               URL: https://ask.libreoffice.org/t/libreoffice-calc-24-2-7-
                    2-wont-ask-for-password-when-opening-encrypted-xlsx/12
                    0931
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 200389
  --> https://bugs.documentfoundation.org/attachment.cgi?id=200389&action=edit
A sample from Ask site; password: 03530

Ref:
https://ask.libreoffice.org/t/libreoffice-calc-24-2-7-2-wont-ask-for-password-when-opening-encrypted-xlsx/120931

This XLSX can be opened using Excel 2016 using password 03530
But opening in in LibreOffice prompts to repair the file, and fails if
confirmed.

The file was generated using Apache POI. The Ask site mentioned this code (I
changed password):

try (POIFSFileSystem fs = new POIFSFileSystem()) {
    EncryptionInfo info = new EncryptionInfo(EncryptionMode.agile,
CipherAlgorithm.aes192, HashAlgorithm.sha384, -1, -1, null);
    Encryptor enc = info.getEncryptor();
    enc.confirmPassword("03530");

    // Read in an existing OOXML file and write to encrypted output stream
    // don't forget to close the output stream otherwise the padding bytes
aren't added
    try (OPCPackage opc = OPCPackage.open(new File("..."),
PackageAccess.READ_WRITE);
        OutputStream os = enc.getDataStream(fs)) {
        opc.save(os);
    }

    // Write out the encrypted version
    try (FileOutputStream fos = new FileOutputStream("...")) {
        fs.writeFilesystem(fos);
    }
}

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to