Dear All,
I have encrypted a table column and I want to display data decrypt data.
I have used below query to encrypt data. I need your help to how I can display data as it is in real.
- OPEN SYMMETRIC KEY CreditCards_Key11
- DECRYPTION BY CERTIFICATE Sales09;
- UPDATE Sales.CreditCard
- SET CardNumber_Encrypted = EncryptByKey(Key_GUID('CreditCards_Key11')
- , CardNumber, 1, HashBytes('SHA1', CONVERT( varbinary
- , CreditCardID)));
- GO
And then the result is coming in my stored procedure is like this:-
- SELECT CustomerID
- AS 'Encrypted ID Number',
- CONVERT(nvarchar, DecryptByKey(CustomerID))
- AS 'Decrypted ID Number'
- FROM tblCustomer
- GO
- CLOSE SYMMETRIC KEY UniqueCUSTOMERID
and the output is :-