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:
- Run Visual Studio .NET or Visual Studio 2005.
- 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.
- 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.
Code:
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:
http://support.microsoft.com/kb/301070
Bookmarks