Link to home
Start Free TrialLog in
Avatar of GoCubs
GoCubsFlag for United States of America

asked on

Problem With SQL Server 2008 R2 Encryption

I'm using SQL Server 2008 R2 Standard Edition and I am trying to figure out encryption. I have done the below without the expected results. Can someone help?

Here are the results:

Encrypted = 0x005A871A34210549973A890DB48C9203010000002278EAE8B8F01147EE0B3C87AC83CB41705196404D43193FCFE8C199B1A4E2BF731C1333667EA445AA00B82F5D237C08

Decrypted = 0x3132332D34352D36302D39333730

CREATE MASTER KEY ENCRYPTION BY PASSWORD = '23987hxJKL969#ghf0%94467GRkjg5k3fd117r$$#1946kcj$n44nhdlj'
GO
CREATE CERTIFICATE TestCERTIFICATE WITH SUBJECT = 'Test CERTIFICATE';
GO
CREATE SYMMETRIC KEY TestKey WITH ALGORITHM = AES_256 ENCRYPTION BY CERTIFICATE TestCERTIFICATE;
GO
OPEN SYMMETRIC KEY TestKey DECRYPTION BY CERTIFICATE TestCERTIFICATE;
go
select	EncryptByKey(Key_GUID('TestKey'), '123-45-60-9370'),
		DecryptByKey(EncryptByKey(Key_GUID('TestKey'), '123-45-60-9370'));
GO
close SYMMETRIC KEY TestKey
go

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of GoCubs
GoCubs
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GoCubs

ASKER

I found it elsewhere online