
The attached sample code encrypts your file by 16 and 32 key secret and decrypts back by 16 and 32 Key. The algorithm used to encrypt and decrypt is Rijndael.
Include #using System.Security.Cryptography namespace in your project before you can use the class. The sample code looks like the following:
Rijndael alg = Rijndael.Create();
alg.Key = pdb.GetBytes(16);
alg.IV = pdb.GetBytes(16);
CryptoStream cs = new CryptoStream(ms, alg.CreateEncryptor(), CryptoStreamMode.Write);
cs.Write(clearBytes, 0, clearBytes.Length);
cs.Close();
byte[] encryptedData = ms.ToArray();
ANOTHER LINKS:
http://mfc-project.blogfa.com/post-23.aspx
OR:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=7468&lngWId=10
ENJOY IT.

Sonu ChaudharyPosted Feb 25, 2016, 7:16 AM
nice article