In this recipe, we will be looking at another capability of the System.IO
namespace. We will be creating a .NET Standard 2.0 library that encrypts an existing text file as well as decrypts it.
Encryption is a great way of securing your files. The System.IO
namespace provides you with great functionality to encrypt and decrypt your content. Let's have a look at how to do it in a .NET Standard 2.0 library.
- Open Visual Studio 2017.
- Click
File
|New
|Project
to create a project. - In the
New Project
dialog box, expand theOther Project Types
node in the left-hand pane, and selectVisual Studio Solutions
. In the right-hand pane, selectBlank Solution
. - In the
Name:
textbox, typeChapter3.SecureFile
and, in theLocation:
textbox, select the path from the drop-down box or click on theBrowse...
button to locate a path.
- Click
OK
. - Now, your
Solution Explorer
(Ctrl + Alt + L) should look like this:
- Now, right-click on the
Chapter3...