Working via memorystream to obfuscate the format

Hi all,
We need to be able to process Word document which contain proprietary information and so would like to secure them.

I know we can use a Word password - but these can be easily cracked.

Therefore what I’m proposing is to implement a layer which:

  • On saving: takes a memorystream from Aspose.Words, encrypts it with our own algorithm, and saves it to disk with our own file extension
  • On loading: reads the file from disk, decrypts it, and presents it to Aspose.Words via a memorystream

Can Aspose.Words use memorystreams like this?

I’m aware of the potential memory overhead - our documents will generally be pretty small.

Regards,

James

Hi James,


Thanks for your inquiry. I am afraid, there is no in-built method to achieve this. But, with Aspose.Words you can easily load Word document from stream and save processed Word document to stream.

On saving, you can save Word document to MemoryStream instance using Aspose.Words, apply encryption on this MemoryStream instance using your own algorithm and finally save this stream as an encrypted file to your disk.

On loading this encrypted file, you need to first transform it back to Word format (you can use your own algorithm to decrypt it) and pass decrypted stream to Aspose.Words’ Document for further processing.

Best regards,

Hi Awais,
Thanks for the information - that’s just the detail I needed. I assumed there was no built-in mechanism, but that I could use the MemoryStream.

Regards,

James

Hi James,


In case you have further inquires or need any help, please let us know.

Best regards,