Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
saahil_k
Starting Member
18 Posts |
Posted - 2008-02-28 : 13:20:47
|
| Hello,I have tables/columns exist.How to encrypt database or mask columns if I have to send a copy of DB to microsoft to troubleshoot for a problem.Thanks. |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-02-28 : 13:32:54
|
| See Encryption features for DB in SQL Server 2005 using certificates and master key. |
 |
|
|
ranganath
Posting Yak Master
209 Posts |
Posted - 2008-02-29 : 01:45:10
|
| hi,Try with this--Create Table dbo.temp (Id Int identity(1,1), Login Varchar(100))--Insert into Temp --Select 'Ranga' union all--Select 'Sai' union all--Select 'Nath' union all--Select 'Keerthi'--Select * From TempIF NOT EXISTS ( SELECT * FROM sys.symmetric_keys WHERE symmetric_key_id = 101) CREATE MASTER KEY ENCRYPTION BY PASSWORD = '23987hxJKL95QYV4369#ghf0%lekjg5k3fd117r$$#1946kcj$n44ncjhdlj'CREATE CERTIFICATE Sales09 WITH SUBJECT = 'Customer Credit Card Numbers';CREATE SYMMETRIC KEY CreditCards_Key11 WITH ALGORITHM = DES ENCRYPTION BY CERTIFICATE Sales09;--ALTER TABLE Temp-- ADD pwd varbinary(128);OPEN SYMMETRIC KEY CreditCards_Key11 DECRYPTION BY CERTIFICATE Sales09;UPDATE tempSET pwd = EncryptByKey(Key_GUID('CreditCards_Key11') , [Login], 1, HashBytes('SHA1', CONVERT( varbinary , id)));OPEN SYMMETRIC KEY CreditCards_Key11 DECRYPTION BY CERTIFICATE Sales09;SELECT id, [Login], Pwd AS 'Encrypted Pwd' , CONVERT(varchar, DecryptByKey(pwd, 1 , HashBytes('SHA1', CONVERT(varbinary, ID)))) AS 'Decrypted Pwd' FROM Temp--Select * From Temp--Drop table Temp--SELECT * FROM sys.symmetric_keys |
 |
|
|
saahil_k
Starting Member
18 Posts |
Posted - 2008-02-29 : 02:01:16
|
| Thanks a lot. |
 |
|
|
|
|
|
|
|