TripleDES Encryption In C#
.NET provides high level classes for various encryption algorithms, both symmetric and asymmetric. Data Encryption Standard (DES) is one of the symmetric encryption algorithms that allows both parties, sender and receiver, to use same key to encrypt and decrypt data.
DES was developed by IBM in 1975. It is considered as an insecure algorithm due to its key size 56 bits and block size 64 bits. However, it successor, Triple DES (3DES) is secure. TripleDES applies DES algorithm 3 times on each block.
TripleDesCryptoServiceProvider class provides the functionality of TripleDES algorithm. This article demonstrates how to use TripleDesCryptoServiceProvider class to apply DES algorithm to encrypt and decrypt data in .NET and C#.
The following steps are required to encrypt data using the TripleDES algorithm.
Step 1
Create TripleDESCryptoServiceProvider,
- TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider();