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!! 7 10592
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]
- mv*@spam.guard.caspershouse.com
<aa*******@gmail.comwrote in message
news:77**********************************@s19g2000 prg.googlegroups.com...
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!!
Another option is to move the file from the filing system into a database
clob field; the application can reverse the process (temporarily) when it
wants to access the file content.
If the contents of the log file are already encrypted, what is the purpose of
enforcing some policy that says nobody is allowed to load the file from the
filesystem? All they would ever see is encrypted characters. If you really
don't want people to even be able to "see" the file, then storing it in the
database as mentioned already would be a good choice. You can encrypta and
decrypt right from within SQL Server:
DECLARE @cleartext NVARCHAR(100)
DECLARE @encryptedstuff NVARCHAR(100)
DECLARE @decryptedstuff NVARCHAR(100)
SET @cleartext = 'This is text that needs to be encrypted.'
SET @encryptedstuff = EncryptByPassPhrase('pigscanfly', @cleartext)
SELECT @encryptedstuff
SET @decryptedstuff = DecryptByPassphrase('pigscanfly', @encryptedstuff)
SELECT @decryptedstuff
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"aa*******@gmail.com" wrote:
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!!
If the contents of the log file are already encrypted, what is the purpose
of
enforcing some policy that says nobody is allowed to load the file from
the
filesystem?
Because for highly sensitive information in particular, it's a security
breach just to let someone know it's even there.
On Tue, 11 Dec 2007 06:50:32 -0800 (PST), aa*******@gmail.com wrote:
>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!!
As an alternative you could consider steganography. Disguise the
encrypted file inside another file, say a .jpg file. When the .jpg
file is opened in Explorer the user just gets the JPG image. When
your application opens a JPG file it knows to look for the hidden
file, extract it and decrypt it.
That might meet your needs. The other users see a file, but not the
file that you want to conceal.
rossum
From: Larry Smith [mailto:no_spam@_nospam.com]
Posted At: Wednesday, 12 December 2007 2:55 AM
Posted To: microsoft.public.dotnet.languages.csharp
Conversation: How to create password protected files thru C#
Subject: Re: How to create password protected files thru C#
If the contents of the log file are already encrypted, what is the
purpose
of
enforcing some policy that says nobody is allowed to load the file
from
the
filesystem?
Because for highly sensitive information in particular, it's a
security
breach just to let someone know it's even there.
In that case, they would still be able to know it is still there if they
are only able to not open it, as the OP requested.
However, I would tend to agree with you on the reasoning, it just
doesn't agree with the OP.
Hi,
You cannot simply say password protect a file whenever you open it in
notepad. That isn't possible. If you want to password protect a file, you
would need to embed a password within the file. For instance...
MyFile RunSecureFileManager -EnterPassword or
GeneratePublicPrivateKey -GenerateSecureFile - SecuredMyFile
You would have to figure out a proper encryption algorithm to use (there are
many outthere). What you could do is private, public keys and include the
public key within the file while encrypting the data, and decrypt it with
the private key within your program.
That is the only way I could think of doing this.
Good Luck!
--
Regards,
Mohamed Mansour
Microsoft Student Partner
"rossum" <ro******@coldmail.comwrote in message
news:af********************************@4ax.com...
On Tue, 11 Dec 2007 06:50:32 -0800 (PST), aa*******@gmail.com wrote:
>>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!!
As an alternative you could consider steganography. Disguise the
encrypted file inside another file, say a .jpg file. When the .jpg
file is opened in Explorer the user just gets the JPG image. When
your application opens a JPG file it knows to look for the hidden
file, extract it and decrypt it.
That might meet your needs. The other users see a file, but not the
file that you want to conceal.
rossum This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Wm |
last post by:
Something just occurred to me... <yeah, I know, it scared me too> I just
password-protected a website by including a password authentication script
in each page of a private section. The script...
|
by: Klaus Kragelund |
last post by:
Hi
I'm using DreamWeaver 2004 on a Win2k machine to create my homepage.
After spending several hours of mingling with ASP I discover that my
ISP doesn't support Access databases. So I turned to...
|
by: MS |
last post by:
Access 97
I have an Access FE that reconnects "automatically" regardless of whether
the FE or BE have been moved to another folder. To achieve this, I have used
Peter Vukovic's ( ...
|
by: connoisseur.infotech |
last post by:
hello
we are developing one tool where we need to open and make password
protected zip files.
we found some solutions but they don't support password protected
things.
does any one knows about...
|
by: Michael Sperlle |
last post by:
Is it possible? Bestcrypt can supposedly be set up on linux, but it seems
to need changes to the kernel before it can be installed, and I have no
intention of going through whatever hell that would...
|
by: clusardi2k |
last post by:
Hello again,
I have to go home and read up on Access.
But, I have read else-where in this newsgroup that I can just save the
password in the database under scrutiny.
Wouldn't it be wasteful...
|
by: Vlad |
last post by:
I am having problems using the file.create method within a function
that is called when looping through an array of filepaths.
If I call my function with a hardcoded file path --C:\Temp.txt the...
|
by: ManWithNoName |
last post by:
Yay guys!
I hope you all are having a warm fuzzy loveable day.
The following questions are kind of related to this thread:
Protect files (on web server) from web admin.
If one has...
|
by: itshibu |
last post by:
I tried to write a program that can open files from the server. But the shared folder in the Win2003 server is password protected. i tried the following code
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |