Re: How to create password protected files thru C#

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Ankit,

Not really. You can't set permissions on a file on an application
basis. Users and groups have rights which are used to resolve access to the
file.

Now, you can encrypt the file, and then make it so only your app has
access to the encryption key (for decrypting the file).

You could also create a shell extension for explorer in an unmanaged
language (you shouldn't create them in .NET) which would prevent other
programs from opening the file (I think), but honestly, I think that is the
wrong approach.

--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx

<aagarwal8@xxxxxxxxx> wrote in message
news:77cf93a5-1bec-43ef-ada3-5b39b0b8d24c@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,

I want to create a log file from my C# code. Currently I am encrypting
the contents of this log file, but now the requirement is that no one
should not be able to open this file from Windows Explorer. (Currently
if we open the file using some editor, the encrypted contents are
displayed)

The file should only be read/modified from within the program.

Is it possible to achieve this functionality in C#? Can i apply some
password to this file from within my program?

Any help in this regard is greatly appreciated.


Regards,
Ankit!!


.



Relevant Pages

  • Re: Filenames appear blue in Windows Explorer
    ... In Windows Explorer: ... See the "Compress contents to save disk space" and "Encrypt contents to ... OfficeOne Animations - Add over 50 animation effects to PowerPoint ...
    (microsoft.public.office.misc)
  • RE: With all the I.D. & info thefts going on How do you feel about data encrytion?
    ... I understand that you want to encrypt the ... How to Use Microsoft Windows Explorer to Encrypt a Folder or a File ...
    (microsoft.public.windows.server.sbs)
  • Re: Folder encryptor
    ... Right-click the file or folder that you want to encrypt, ... Select the Encrypt contents to secure data check box. ... * To open Windows Explorer, click Start, point to Programs, point to ... subfolders within the folder to be encrypted as well. ...
    (microsoft.public.windowsxp.general)
  • Re: Enable "Encrypt contents to secure data" option in Windows Explore
    ... To open Windows Explorer, click Start, point to All Programs, point to ... You can only encrypt files and folders on NTFS file system volumes. ... encrypt a compressed file or folder, that file or folder will be ... subfolders within the folder to be encrypted as well. ...
    (microsoft.public.windowsxp.general)
  • Re: Encrypt/Decrypt SQL Server 2005 data files
    ... First, according to Microsoft, you cannot use SQL if the log file is encrypted. ... decrypt takes many minutes and the long required time makes the technology impractical to use. ... Maybe you can encrypt just the snsitive part of the data? ...
    (microsoft.public.sqlserver.security)