0

I'm creating a new database application using C# and MS-Access, I want to make the database file ONLY accessible for (read/write) operations from within my application so that the user haven't the ability to open the file from outside the application but the application has the full access to the database file, Or may be a better way is to make this permission for the root folder of the database. Someone may ask "Why don't you just set a password for the database?" My reply is that I want the root folder completely inaccessible and therefore the user won't know the database type I'm using because I will change the file extension for it. As far as I know that the Windows OS uses the NTFS permissions -Groups- to make a folder accessible only for a set of groups like (Trusted Installer, System, Users,...) Can I Achieve my goal using NTFS Permissions, or may be there is a better way to handle this?

Ahmed Suror
  • 439
  • 6
  • 17
  • This isn't possible (if your program can modify it, the user [with administrator rights] can modify it, too), the only thing you can do is, saving it somewhere else than the other files (e.g. in %APPDATA%\[...]), so that the user can't get to it easily. – Graphican0 Jan 03 '16 at 18:17
  • @TehRialHolk I cannot just save it somewhere else because of the danger of data loss, additionally during the first initialization of the program I'm giving the user the ability to select the folder to save the database file into, that way he will exactly know the path – Ahmed Suror Jan 03 '16 at 18:49

1 Answers1

1

I added fixed length encrypted bytes to the start of file using low level file read write operations and my app upon execution removed the bytes and had given me the actual file and I blocked the starup menu and short cuts keys and context menus using windows api so only my app had access to it plus I enabled windows stuff upon app termination and encrypted database again so it was unreadable for another access enabled app.

wui
  • 400
  • 3
  • 11
  • Can you mention how did you do that in detail please? – Ahmed Suror Jan 03 '16 at 18:51
  • 1
    For access you can read entire file in one variable and append it to the variable like variable=length32bytes+filecontent and create new file and put the content inthat file and rename it to actual file name. For disabling keys and startup things changed you can read here:http://stackoverflow.com/questions/4940796/how-can-i-disable-the-start-button-but-not-the-taskbar-on-windows-7 – wui Jan 03 '16 at 19:23