Skip to content

Encrypted File raises FileFormatError: Unrecognized file format, using Sensitivity Label #78

@philmae

Description

@philmae

I have a file protected with a company Sensitivity Label encrypted and am trying to open it, but get an error Unrecognized file format.
image

import msoffcrypto
protected = './protected.xlsx'
unprotected = './unprotected.xlsx'

with open(protected, 'rb') as f:
   ms_file = OfficeFile(f)
   print(ms_file)

And I get
FileFormatError: Unrecognized file format

Also, when checking .is_encrypted(), the file gives the same issue.

with open(protected, 'rb') as f:
   ms_file = OfficeFile(f).is_encrypted()
   print(ms_file)

The file is working and if I use Unencrypted reads fine. The file is not password protected, but just uses the sensitivity label as encryption.

I expected that is_encrypted should at least say True, and not just fail completely.
Not sure if the current implementation can even open these files with a sensitivity flag, even if you have the key

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions