2

I want to open encrypted OOXML files, which are stored as streams inside a compound OLE file. Microsoft has an API for OOXML, (OOXML Format SDK 2.0, but it seems to lack a way to manipulate encrypted OOXML documents. So, this breaks into two questions.

  • How do you open compound OLE documents in C#? I found this very similar question, (reading compound documents in C#), but I was hoping that there might be a cleaner and more generic way of doing it that I missed.

  • Is there a high-level way to decrypt the EncryptedPackage stream within the OLE document? The two best references I've found are Decrypting Office Documents and MS-OFFCRYPTO Examples. "Decrypting Office Documents" seems to decrypt successfully, but it relies on an external DLL (Lyquidity.OleStorage.dll) to open the OLE document and did not work for me. "MS-OFFCRYPTO Examples" has an example in C# to decrypt the stream but uses a C++ example to get the stream. Both these references look like they work, but is there a higher level API that does the same thing?

Community
  • 1
  • 1
Joe
  • 3,370
  • 4
  • 33
  • 56
  • Similar question: http://stackoverflow.com/questions/1502781/read-write-excel-2007-password-protected-documents – dbkk Oct 01 '09 at 19:12

1 Answers1

1

Short answer: no there is no higher level API. Long answer: the MS-OFFCRYPTO Examples is the best example of how to decrypt it, but you will have to use a library (or make your own) for interacting with the OLE document. There are many libraries for OLE Structured Storage such as OpenMCDF and the library from GemBox Software

David B Heise
  • 386
  • 1
  • 8