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 2008 Forums
 Transact-SQL (2008)
 Decrypted data coming out in... Korean?

Author  Topic 

stonebreaker
Yak Posting Veteran

92 Posts

Posted - 2010-06-22 : 08:23:38
I used the first encryption example in the online books article
ms-help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_4deptrbl/html/38e9bf58-10c6-46ed-83cb-e2d76cda0adc.htm

I changed it slightly to use my own database and table, but otherwise left it alone. The data seems to encrypt ok, but when I decrypt it I get this:
Plain SSN Encrypted SSN Decrypted SSN
123456789 <Encrypted binary> ????9
132989999 <Encrypted binary> ????9
997999999 <Encrypted binary> ????9

I tried changing the data type for the encrypted data from varbinary(128) to varbinary(256), and no luck. Any help would be greatly appreciated.

Stonebreaker
The greatest obstacle to discovery is not ignorance - it is the illusion of knowledge.
-Daniel Boorstin

stonebreaker
Yak Posting Veteran

92 Posts

Posted - 2010-06-22 : 09:47:19
Nevermind, I found the bug. The column being encrypted was a varchar, and I was converting to an nvarchar when decrypting.

(_8(|) D'oh!

Stonebreaker
The greatest obstacle to discovery is not ignorance - it is the illusion of knowledge.
-Daniel Boorstin
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-06-22 : 11:07:34
Useful to know that though .. thanks for "reporting back"
Go to Top of Page

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2010-06-22 : 19:41:29
(North or South Korean?)

=======================================
A couple of months in the laboratory can save a couple of hours in the library. -Frank H. Westheimer, chemistry professor (1912-2007)
Go to Top of Page
   

- Advertisement -