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: Modern Cross-Platform Development - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.