• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

Is it possible to decrypt data in SQL if it was encrypted in .net?

Is it possible, using either SQL2000 or SQL2005, to decrypt data that was encrypted by the front-end .net web code? (On the website, data was encrypted before being imported into database table).

I'm not familiar with web, but I do know that PasswordDerviceBytes and Rijndael was used to encrypt:
 
PasswordDeriveBytes Object = PasswordDeriveBytes(ThePassword, new byte[] {0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d,  0x65, 0x64, 0x76, ....});
...
...
Rijndael alg = Rijndael.Create();
alg.Key = Key;
alg.IV = IV;
...
...

I have access to the data and know ThePassword. Using the password, is there a SQL script that can decrypt the data? (The ultimate goal is to deliver this data in a file, with the data in un-encrypted format so the users can read it)

I'm not sure if this is possible? A similar question was asked here but never answered: http://www.experts-exchange.com/Community_Support/General/Q_22028650.html?sfQueryTermInfo=1+data+decrypt+passwordderivebyt

THANK YOU FOR YOUR HELP!!!

0
trpnbillie
Asked:
trpnbillie
  • 2
2 Solutions
 
momi_sabagCommented:
if you can decrypt the data using .net code then you can create a clr stored procedure or clr function (clr functions/procedures are sql server procedures/functions that are written in .net code instead of tsql)
this feature is available in sql 2005 and it can solve your problem
0
 
Abh4ITCommented:
Hi,

From SQL 2005 it supports CLRHosting that is SQL can run programs written for CLR. Therefore the same application could be loaded into SQL Server andexecuted in SQL Server. This allows you to reuse the same code written for CLR.
Some posting on this aspect
http://aspalliance.com/1081_CLR_Integration_in_SQL_Server_2005
And this one shows how to create UDF-User Defined Functions using .NET
http://www.novicksoftware.com/coding-in-sql/Vol3/cis-v3-N13-dot-net-clr-in-sql-server.htm
0
 
trpnbillieAuthor Commented:
Thank you both. I am going to try to implement this and will report back my findings!
0
 
trpnbillieAuthor Commented:
You have provided the solution! Using a CLR stored procedure is allowing me to call the decryption method that is in the .NET code. I am running into a another problem in that the data is only 75% decrypted. I'll open a separate question for that as I believe it may be related to the data being from a SQL 2000 database.  (I imported the data from SQL2000 to a SQL2005 db in order to use CLR) THANKS AGAIN!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now