1

I have data from an Informix database that has a column with data encrypted using the Informix function ENCRYPT_TDES. The data was imported into SQL SERVER 2008 and I no longer have access to a running instance of Informix. I need to write a C# or VB.NET function for decrypting that data. Anyone know how to write a C# function to decrypt it?

Josh Danko
  • 123
  • 9
  • Are you assuming that the Cryptology Class will understand how Informix database encrypted the code..? also how were you encrypting the code in the informix database before..? When you say you have Data.. is this your Data or are you trying to illegally Crack data that you have come across..??? – MethodMan Jan 06 '12 at 20:44
  • I do database conversions for a living, one of my co-workers has done a Informax to MS-SQL conversion. When he gets back to work tomorrow I will have him post here. – Scott Chamberlain Jan 06 '12 at 20:53
  • @ScottChamberlain thanks. DJ KRAZE no it is my companies database and I have the passphrase it was encrypted with. I just need a way to decrypt using MSSQL functions OR C#. – Josh Danko Jan 06 '12 at 22:22
  • here take a look at example previous post on StackOverFlow http://stackoverflow.com/questions/202011/encrypt-decrypt-string-in-net also look on google at C# and Decrypting passwords with a passPhrase or Salt key have a good weekend – MethodMan Jan 06 '12 at 22:53

1 Answers1

0

The way that the data is stored for encrypted data with ENCRYPT_TDES or ENCRYPT_AES is not documented, and is not obvious. It includes control information for which algorithm was used (so you normally decrypt the data server-side with DECRYPT_CHAR() or DECRYPT_BINARY(), without specifying which algorithm was used), the hint (if present), and the IV that was used, all encoded with a Base-64 encoding. The hint is essentially freely available (anyone can use the GETHINT() function on the data to get the hint, without knowing the right password) but it is stored lightly encrypted with a fixed key.

So, yes, you could in principle write C# code to decrypt the data, but you would have to be ready to deal with either Triple-DES (TDES) or AES (128-bit) encryption, and you'd have to understand the internals of the data format.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278