|
-
Apr 14th, 2010, 07:35 AM
#1
Thread Starter
Member
Encrypt a file then Read it
So I have a connection string which is read from a basic text file. This string contains a password. Is there anyway to encrypt this text file so that anyone can't just open it up and read it. The program will still be able to read it.
-
Apr 14th, 2010, 07:44 AM
#2
Lively Member
Re: Encrypt a file then Read it
Search the forum for Encrypt Decrypt. There are loads of posts relating to file encryption and decryption.
-
Apr 14th, 2010, 07:48 AM
#3
Re: Encrypt a file then Read it
Yes, it is possible. In order to encrypt and decrypt a file you will need to use the System.Security.Cryptography Namespace.
I don't have any code sample right now as I'm at work but I'm pretty sure you can find a lot by a simple google search, or maybe someone else will post some.
Basically what you will need to do is choose a cryptography Symmetric Algorithm use it encrypt and decrypt your file. Your application will need to know the password that was used to encrypt the file to be able to decrypt it.
here's a good example
Alex
.NET developer
"No. Not even in the face of Armageddon. Never compromise." (Walter Kovacs/Rorschach)
Things to consider before posting.
Don't forget to rate the posts if they helped and mark thread as resolved when they are.
.Net Regex Syntax (Scripting) | .Net Regex Language Element | .Net Regex Class | DateTime format | Framework 4.0: what's new
My fresh new blog : writingthecode, even if I don't post much.
System: Intel i7 920, Kingston SSDNow V100 64gig, HDD WD Caviar Black 1TB, External WD "My Book" 500GB, XFX Radeon 4890 XT 1GB, 12 GBs Tri-Channel RAM, 1x27" and 1x23" LCDs, Windows 10 x64, ]VS2015, Framework 3.5 and 4.0 
-
Apr 14th, 2010, 07:49 AM
#4
Frenzied Member
-
Apr 14th, 2010, 07:50 AM
#5
Frenzied Member
Re: Encrypt a file then Read it
Rijndael is a symmetric key algorithm.....keep it in mind before having a go at the above link
If you find my reply helpful , then rate it
-
Apr 14th, 2010, 08:03 AM
#6
Re: Encrypt a file then Read it
Does it need to be in a text file? Connections strings are generally stored in the config file, which supports encryption inherently. Follow the CodeBank link in my signature and check out my Protected Configuration thread for more info.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|