Hi,
I am encrypting a column in a table. When I decrypt, everything is great if the data contained in column is less than 30 chars. If it has more than 30 chars, I still get 30 chars decrypted. Not sure what I am doing wrong. Below are my details:
OPEN SYMMETRIC KEY sk_XEncryption
DECRYPTION BY CERTIFICATE cert_sk_X
SELECT ISNULL(CONVERT(NVARCHAR,DECRYPTBYKEY(columnA)),'')
FROM table1
CLOSE SYMMETRIC KEY sk_XEncryption
Additional details:
"columnA" above is of VARBINARY(4000) datatype. I have enven tried changing the column to VARBINARY(MAX). The data is ecrypted with a symmetric key (algorithm = triple_des ). Any tips are appreciated. TIA.
Does it help if you specify the length for the NVARCHAR output?
For example:
SELECT ISNULL(CONVERT(NVARCHAR(255),DECRYPTBYKEY(columnA)),'')
FROM table1
|||That helped!!! Thanks a lot.
No comments:
Post a Comment