I have been started reading and experimenting the encryption and decryption techniques in C#
I have tried Data Encryption and Decryption in SQL Server 2008 using the information available in the following link
By using following query (from example of link) I can able to decrypt a value using SQL queries
OPEN SYMMETRIC KEY Sym_password
DECRYPTION BY CERTIFICATE Cert_Password WITH PASSWORD = 'Password!2';
SELECT CAST(DECRYPTBYKEY([Password]) as varchar(200))
FROM Security
CLOSE SYMMETRIC KEY Sym_password;
How can I do the same operation from my C# application?
In my MVC application, I'm using email address as my username to login (password is hashed by default using simple membership). Please suggest me the best ways to encrypt the email field in SQL level and decrypt those values in C#(application level)
When a user enters his username (email) in application, How can I encrypt that value in application side and compare it with the encrypted value in the SQL records.
Insert Query(encryption):
Select Query(decryption):