Posted on: 5/30/2012 9:22:31 PM | Views : 233

Working with sql server 2008 express. 

Encryption works perfectly.
public string Encrypt(string clearData, string password) { //Convert text to bytes byte[] clearBytes = Encoding.Unicode.GetBytes(clearData); //We will derieve our Key and Vectore based on following //password and a random salt value, 13 bytes in size. var pdb = new PasswordDeriveBytes(password, new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 }); byte[] encryptedData = Encrypt(clearBytes, pdb.GetBytes(32), pdb.GetBytes(16)); return Convert.ToBase64String(encryptedData); } // Encrypt function public byte[] Encrypt(byte[] clearData, byte[] key, byte[] iv) { byte[] encryptedData; //Create stream for encryption ...

Go to the complete details ...