Protecting file by program RRS feed

  • Question

  • Is it possible to limit access to a file based on the program accessing it?

    I am trying to create a VB program that interacts with an XML file to store and retrieve user accounts and passwords.  I would like for my program to be the only thing that can access the XML file, but still have the ability to edit it inside of the program. Is it possible?

    Wednesday, August 11, 2010 1:27 PM


  • What you really want to do is encrypt the file so that even if another program (or simply the user) were to try to view the contents of the file, it would just be scrambled encrypted data that they would not be able to do anything with.

    Your program would need to decrypt the file to read its contents, and encrypt it again back to file when the contents of the file need to change (for example when the user ads or modifies a user account/password).

    The .NET framework has many built in encryption libraries, and a quick search on the web should turn you up some good examples.

    Here is 1 example from the MSKB


    Matt Kleinwaks - MSMVP MSDN Forums Moderator - www.zerosandtheone.com
    Wednesday, August 11, 2010 2:26 PM