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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 symmetric key problem

Author  Topic 

rammohan
Posting Yak Master

212 Posts

Posted - 2008-01-23 : 01:27:14
hi,
here i have encrypted the column named password as follows:
create symmetric key sk_login with algorithm = aes_192 encryption by password = 'VB.net2.0'

open symmetric key sk_login decryption by password = 'VB.net2.0'

insert into TBL_LOGIN(LOGINNAME,[PASSWORD]) values('radhika',encryptbykey(key_guid('sk_login'),'radhika'))

but, when ever i am trying to decrypt this column i am getting null value.

Select LOGINNAME,[PASSWORD], Convert(varchar(50), DecryptByKey([PASSWORD],1)) as [password] from TBL_LOGIN

please help me on this

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

irwan
Starting Member

3 Posts

Posted - 2008-01-23 : 02:35:54
Dear Rammohan,
have you set the field type for the password to varbinary(max)? Try to change it to varbinary before you encrypt it, then try to decrypt. Hope it solved the problem...


Regards,
irwan
Go to Top of Page
   

- Advertisement -