469,632 Members | 1,698 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,632 developers. It's quick & easy.

Creating secure files

I am working on a program and need to store sensitive data. I am able to
create text files but I need to files to be secure. Do I use the hash class
to secure my data and how would this affect new data being added to the
file? Any help would be appreciated.
Aug 17 '06 #1
2 1820
If you mean by secure, you want to make sure that the files are not
readable by anyone else, then you can't hash them. You will have to encrypt
them with a key. If your files are going to be processed on the same
machine, or by one particular user, then I would recommend looking into a
managed wrapper for the DPAPI (Data Protection API). The reason I recommend
this is that DPAPI will encrypt data for you without having to store a key
or load it from your program. This is an issue because .NET assemblies can
be decompiled, and if you have a routine to get a key in your program, it
would be easy to see how to duplicate that key, as well as the algorithm
used to access the file.

The hash will give you a fixed length buffer that is relatively unique
for different values in your file. It won't do anything to keep people from
being able to read the file. However, you can make sure that the files were
not modified by storing the hash of the contents in the file somewhere (you
will want to look up salts as well when doing this). This way, when you
decrypt the file, you can read the hash, then the contents. If the contents
don't hash correctly, you know the file was tampered with.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<mo******@yahoo.comwrote in message
news:44***********************@fe4.nntpserver.com. ..
>I am working on a program and need to store sensitive data. I am able to
create text files but I need to files to be secure. Do I use the hash
class
to secure my data and how would this affect new data being added to the
file? Any help would be appreciated.

Aug 17 '06 #2
After reading up on DPAPI I ended up with another question. The help file
talks about using DPAPI for creating web applications. Is there another way
to secure files in an application not designed for the web?
Aug 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Jerry Camel | last post: by
12 posts views Thread by Mats Lycken | last post: by
15 posts views Thread by David Thielen | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.