Encrypting and decrypting data

There are multiple encryption algorithms you can choose from in .NET Core. Some algorithms are implemented by the operating system and their names are suffixed with the CryptoServiceProvider class, some are implemented entirely in .NET, some use symmetric keys, and some use asymmetric keys.

Tip

Best Practice

Choose AES for symmetric encryption and RSA for asymmetric encryption.

Encrypting symmetrically with AES

To make it easier to reuse your protection code in the future, we will create a static class named Protector in its own class library.

Using Visual Studio 2017

In Visual Studio 2017, press Ctrl + Shift + N or navigate to File | New | Project....

In the New Project dialog, in the Installed | Templates list, expand ...

Get C# 7 and .NET Core now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.