EncryptbyKey VARCHAR(50)
-
Hi guys, I am having a weird issue, I am trying the following and for some reason varchar(50) value is set to null when I encrypt or decrypt it. If I change it from varchar to nvarchar it works. Our table in the database is already set to varchar to store the encrypted information and can't change it due to licensing issues. Please help, what am I doing wrong? OPEN SYMMETRIC KEY DSBEncryptionKey DECRYPTION BY CERTIFICATE EncryptDsb DECLARE @encryptedNum varchar(50) -- varchar doesn't work here, nvarchar works SELECT @encryptedNum=EncryptByKey(Key_GUID('DSBEncryptionKey '), '111000614'); select CONVERT(varchar(50),decryptbykeyautocert(cert_id('EncryptDsb'), NULL, @encryptedNum)) FYI, my symetric key uses AES_256 algorithm. Please help!
Sameer