Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem opening certain encrypted spreadsheets in Excel #128

Open
pbowyer opened this issue May 3, 2018 · 0 comments
Open

Problem opening certain encrypted spreadsheets in Excel #128

pbowyer opened this issue May 3, 2018 · 0 comments
Labels

Comments

@pbowyer
Copy link

pbowyer commented May 3, 2018

I've been testing the encryption feature to add encryption to existing workbooks a web app generates. Some work brilliantly, but with more complex workbooks they encrypt without any error but won't open in Excel.

image

Excel then shows the dialog:
image
If I click 'Yes' Excel hangs and has to be force-closed.

I thought our spreadsheets could be the issue (they are generated with box/spout) so tested encrypting with herumi/msoffice. Excel is able to decrypt these ones without issue.

xlsx-populate setup

I installed it yesterday via npm:

`-- xlsx-populate@1.14.1
  +-- cfb@1.0.7
  | +-- commander@2.15.1
  | `-- printj@1.1.2
  +-- jszip@3.1.5
  | +-- core-js@2.3.0
  | +-- es6-promise@3.0.2
  | +-- lie@3.1.1
  | | `-- immediate@3.0.6
  | +-- pako@1.0.6
  | `-- readable-stream@2.0.6
  |   +-- core-util-is@1.0.2
  |   +-- inherits@2.0.3
  |   +-- isarray@1.0.0
  |   +-- process-nextick-args@1.0.7
  |   +-- string_decoder@0.10.31
  |   `-- util-deprecate@1.0.2
  +-- lodash@4.17.10
  `-- sax@1.2.4

My code to encrypt the file is:

const XlsxPopulate = require("xlsx-populate");
XlsxPopulate.fromFileAsync("./nta-anonymised.xlsx", {})
.then(workbook => {
    workbook.toFileAsync("./nta-enc-xlsxpopulate.xlsx", { password: "testing123" });
});

Excel

Microsoft Excel 2016 MSO (16.0.8431.2110) 32-bit
Running on Windows 10 Pro

msoffice-crypto

Built yesterday from Git, on Ubuntu 16.04. When run on the file outputs:

$ msoffice-crypt -e -p testing123 nta-anonymised.xlsx nta-enc-msoffice-crypt.xlsx -v
inFile=nta-anonymised.xlsx, outFile=nta-enc-msoffice-crypt.xlsx, mode=enc, encMode=0
encryptionInfoStr size=1056
miniFatNum=26
miniFatDataSectorNum=4
encryptionPackageSectorNum=21
contentSectorNum=29
fatSectorNum=1
difatSectorNum=0
allSectorNum=30
data.size=15872

Sample files

File Purpose
nta-anonymised.xlsx The raw, unencrypted file
nta-enc-xlsxpopulate.xlsx Encrypted with xlsx-populate, does not open in Excel
nta-enc-msoffice-crypt.xlsx Encrypted with herumi/msoffice and opens in Excel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants