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