Encrypting and decrypting data
In .NET, there are multiple encryption algorithms you can choose from.
In legacy .NET Framework, some algorithms are implemented by the operating system and their names are suffixed with CryptoServiceProvider
. Some algorithms are implemented in the .NET BCL and their names are suffixed with Managed
.
In modern .NET, all algorithms are implemented by the operating system. If the OS algorithms are certified by the Federal Information Processing Standards (FIPS), then .NET uses FIPS-certified algorithms.
Generally, you will always use an abstract class like Aes
and its Create
factory method to get an instance of an algorithm so you will not need to know if you are using CryptoServiceProvider
or Managed
anyway.
Some algorithms use symmetric keys, and some use asymmetric keys. The main asymmetric encryption algorithm is RSA.
Symmetric encryption algorithms use CryptoStream
to encrypt or decrypt large amounts of bytes efficiently. Asymmetric...