Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Thread Tools Search this Thread
Old 06-02-2009
Join Date: Feb 2009
Posts: 105
Encrypt file using VB.NET/Visual Studio 2005

Hi Friends,

I am newbie to the VB.Net and am currently using Visual studio 2005 to Practise with, I am doing it myself through some information from the PDF files that I have taken from my friend, I know VB.Net is very flourish language along with user friendly contents, My friend has also told me that It is also possible to Encrypt the file using VB.Net, so my curiosity wakes up know more about it, so can any there to explain me how we can achieve encryption in VB.Net.

Thanks to those who will help!!
Reply With Quote
Old 06-02-2009
Join Date: Apr 2008
Posts: 193
Re: Encrypt file using VB.NET/Visual Studio 2005

The System.Security.Cryptographic namespace in the .NET Framework provides a variety of tools to aid in encryption and in decryption. The CryptoStream class is one of the many classes that is provided. The CryptoStream class is designed to encrypt or to decrypt content as that content is streamed out to a file.

To encrypt a file, follow these steps:
  1. Run Visual Studio .NET or Visual Studio 2005.
  2. Create a new console application in Visual Basic .NET or in Visual Basic 2005. A module is created for you, together with an empty Main() procedure.
  3. Use the Imports statement on the System namespace, the System.Security namespace, the System.Security.Cryptography namespace, the System.Text namespace, and the System.IO namespace. You must do this so that you do not have to qualify declarations from these namespaces later in your code. You must use these statements before any other declarations.

Imports System
Imports System.IO
Imports System.Security
Imports System.Security.Cryptography
Imports System.Runtime.InteropServices
Imports System.Text
For further details on how to Encrypt file please visit to the following site:
Reply With Quote
Old 06-02-2009
Join Date: Dec 2008
Posts: 202
Re: Encrypt file using VB.NET/Visual Studio 2005

I will suggest some really simple encryption ideas here. One of these is called "exclusive OR" (XOR) encryption. The idea is that you XOR a file byte by byte to produce something that looks like a jumbled mess. But all you have to do is XOR the same file to reverse the encryption. There's an assembly language routine that can implement this method in 42 bytes! Something this simple (and easy to crack) hardly deserves the name encryption.

If you study this program thoroughly, you should have no trouble coding your own string manipulation.

The way this program works is to type a message into a TextBox. The unencrypted and encrypted versions of the message appear simultaneously. When you click the Stash It! button, an encrypted file and a key file are written to disk. Then you can keep the two files seperate and the information in the encypted file will be relatively safe from anyone who doesn't have the key file. To decrypt again, just input both programs into a very simple decryption program that we'll also write here and the original information is recovered.
Reply With Quote
Old 06-02-2009
Join Date: Mar 2008
Posts: 232
Re: Encrypt file using VB.NET/Visual Studio 2005

Encryption and Decryption

Here you have good idea about the encryption/decryption process. This block of code has been modified from an article called ?Tales from the Crypto? by Billy Hollis. Here is what happens in this procedure:

* Define the enumeration for CryptoAction (encrypt/decrypt).
* Begin with an encrypted/unencrypted file.
* Use a FileStream object to open and read the file.
* Use a CryptoStream object to perform encryption/decryption.
* Use another FileStream object to write the encrypted/decrypted file.

For coding part please visit the following:

Reply With Quote

  TechArena Community > Software > Software Development
Tags: , , ,

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads for: "Encrypt file using VB.NET/Visual Studio 2005"
Thread Thread Starter Forum Replies Last Post
How well is supported TBB in Visual Studio 2005 Tamonash Software Development 8 27-09-2010 11:59 PM
Cannot debug any program on Visual Studio 2005 N I C K Software Development 4 22-01-2010 08:10 PM
Difference between Visual studio 2005 and Visual studio 2008 RohanS Software Development 3 12-06-2009 10:48 AM
Want Visual Studio 2005 Aashish Software Development 1 14-11-2008 02:02 PM
Error trying to install Visual Studio 2005 Pro Aadimoolan Window 2000 Help 1 31-08-2007 11:44 PM

All times are GMT +5.5. The time now is 12:53 PM.