0

I have an application written using C++ that reads/writes binary data from a folder in windows. I want to make sure that only my application with the proper key can read/write this binary data from a specific folder and no one should be able to access it.

Is it possible to achieve this on windows using win C++ API? Any suggestions would be invaluable.

Thanks!

sp497
  • 2,363
  • 7
  • 25
  • 43
  • You can encrypt/decrypt you data from inside the application and store/read encrypted data. There are a lot of algorithms/libraries for encryption. – Jepessen Jul 03 '15 at 06:58
  • What are you trying to guard against here? Are you just trying to protect against another program accidentally overwriting your data, or are you trying to implement some sort of DRM? – Ryan Bemrose Jul 03 '15 at 07:03
  • @RyanBemrose No its not just about another program accidentally overwriting my data but the confidential data present in this folder should not be accessed by anything else other than my application. – sp497 Jul 03 '15 at 07:06
  • The Windows Security Model is user-centric, not application-centric. How are you going to prevent other applications from just stealing the data out of your application? – MSalters Jul 03 '15 at 07:18
  • @MSalters Yes that is what my question is. Is it possible to have application centric access to a folder in windows? – sp497 Jul 03 '15 at 07:19

1 Answers1

1

The operating system will not do this for you. Anything you write to the disk can be read by any user or program with administrator rights, so you will need to encrypt your data before writing to disk.

On Windows, you can look into the Win32 Crypto API for a generic built-in implementation. Or you can use one of dozens of available libraries for doing the same thing. A quick SO search for "free windows encryption libraries" turned up a couple of old posts that might get you started. You'll have to do your own research.

The one thing I will caution you against is do not try to write your own cryptography. Security is a Hard Problem, and you will not be able to do it better than the existing well-established libraries.

Community
  • 1
  • 1
Ryan Bemrose
  • 9,018
  • 1
  • 41
  • 54