Tech:
C#
ASP.NET Core 2.0
Excel (Mostly OpenXml, but occasional legacy document)
Currently using ExcelDataReader to read the files.
Scenario:
I need to store some files on a server and access them later to do work. Users upload the files through a web API and make calls requesting work to be done in the same way.
Some of the users password-protect their Excel files, and it is a requirement that these files remain password-protected while on the server.
Problem:
I need to detect whether the document is password-protected so I can use the appropriate configuration to access it.
I've googled this a good bit, but it mostly comes up with Workbook.HasPassword (I think this is part of Excel.Interop, which I'd like to avoid adding). I also found this link to a similar question on Office documents, in which the solution was a long checklist against various header data via file stream.
Ideally, I'd like a Core-friendly solution that does not require me to open the file. I don't work with documents that often so I'm at a loss as to where to look next.
Any suggestions?