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 2000 Forums
 SQL Server Administration (2000)
 EncryptByCert & DecryptByCert

Author  Topic 

scottpt
Posting Yak Master

186 Posts

Posted - 2006-08-15 : 11:29:27
Having some issue tihe this. Running 2005 sp1.

Create MASTER KEY ENCRYPTION By PASSWORD ='youngdudes'

CREATE CERTIFICATE WebSitePWDCert
ENCRYPTION BY PASSWORD ='cr3wk1ck5b4ll5'
WITH SUBJECT = 'This cert encrypts the web site pwd'
GO
Create Table ini_file
(ini_name varchar(20),
ini_binary varbinary(8000)
)
go
INSERT INTO ini_file (ini_name,ini_binary)values ('Access',EncryptByCert(cert_id('WebSitePWDCert'),'Gre55ysp00n'))
GO
select convert(nvarchar(max), DecryptByCert(cert_id('WebSitePWDCert'),ini_binary,N'cr3wk1ck5b4ll5'))
from ini_file
where ini_name ='ACCESS'

THIS RETURNS

------------------------------------------------------------
Ƭ#13669;µdž¾#12336;n

The Decryption is not working. Has anyone else had success with this?

scottpt
Posting Yak Master

186 Posts

Posted - 2006-08-16 : 08:27:06
FIgured it out had to change nvarchar to varchar. BOL has it as a nvarchar so the cut and paste dose not work.
Go to Top of Page
   

- Advertisement -