Click here to Skip to main content
15,887,397 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to save the password in the database in encrypt form......
Posted
Comments
[no name] 3-May-12 15:33pm    
OK. What have you tried?
Bernhard Hiller 15-May-12 2:42am    
Do you want to be able to get the non-encrypted password again, or is it enough when you can verify that a password entered by a user and the password stored in the database are the same? That makes a huge difference!

 
Share this answer
 
Step 1:
Create a SQLCLR UDF like in this example:

public string encryptString(string s, string key){}

http://msdn.microsoft.com/en-us/library/w2kae45k%28v=vs.80%29.aspx

Step 2:
You could implement encryption logic like in the example

http://msdn.microsoft.com/en-us/library/system.security.cryptography.rijndaelmanaged.aspx

Step 3:
Store the encryption key in you application config file mostly to follow best practices.

Step 4:
Register the UDF with your database.

Step 5:
You should be able to use the encyptionString implementation as a method in you application code or in your DB code as a UDF.

Caveman | http://cavemansblog.wordpress.com
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900