Skip to main content

Posts

Showing posts from October, 2020

Read An Encrypted File In Visual Basic

There are many ways to decrypt encrypted text or data. In this tutorial, I'm using DESCryptoServiceProvider class to encrypt and decrypt strings using the cryptographic service provider version of the Triple Data Encryption Standard algorithm. The use encryption to protect secret data and to make data unreadable by unauthorized users. In this tutorial I'm going to use the existing project from the previous tutorial Write An Encrypted Text File . Check this tutorial to see how to write an encrypted text file. And today I will modify the previous tutorial and add a methods to read an encrypted file. Procedure Download the previous project at Write An Encrypted Text File . Rename the project to  ReadEncryptedFileVB . Load the project and open the FormMain then add new CommandButton and set the name property to  ButtonReadFile and set the text property to  Read Encrypted File . Resize the button to display the text property. Set the  ButtonWrite text property to  Write Encrypted

Read A Text File In Visual Basic

There are many ways to write text or string to a file. In this tutorial, we are going to use StreamReader class. StreamReader is designed for character input in a particular encoding, whereas the Stream class is designed for byte input and output. Use StreamReader for reading lines of information from a standard text file. Required Preferences System.Runtime.Extensions.dll for StreamReader class Procedure Open the previous project from  Write Text To File In Visual Basic Tutorial  and rename the project to ReadFileVB or create a new project but it is recommended to use the existing project in the said tutorial. Once the project is loaded, open the FormMain and add new CommandButton and set the name property to  ButtonReadFile and text property to  Read File Double click on to ButtonReadFile to view the code then copy the codes below and paste it to ButtonReadFile_Click event. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 3

Write An Encrypted Text File In Visual Basic

There are many ways to encrypt text or data. In this tutorial, DESCryptoServiceProvider class to encrypt and decrypt strings using the cryptographic service provider version of the Triple Data Encryption Standard algorithm. The use encryption to protect secret data and to make data unreadable by unauthorized users. Creating encryption wrapper Open the previous project from this tutorial  Write Text To File In Visual Basic  then rename it to WriteTextToFileWithEncryptionVB or create a new project. I recommend to open the existing project to easily follow this tutorial. Create the Encryption3DesWrapper class to implement the encryption and decryption methods. 1 2 3 Public NotInheritable Class Encryption3DesWrapper End Class Add an import of the cryptography namespace to the start of the file that contains the Encryption3DesWrapper class. 1 2 3 4 5 Imports System.Security.Cryptography Public Class Encryption3DesWrapper End Class In the Encryption3DesWr