tags:

views:

324

answers:

1

I am trying to decrypt (using the DES algorithm) data that comes from a third party in C# code. There are plenty of examples here and elsewhere that have helped me out. The problem is that I don't know what to use for the 'initialization vector'.

The third party supplied a tool for use on the command line (DES.EXE, which I believe is an out-of-the-box build of the libdes library v4.01) which only requires that you supply an encryption key. So, I can decrypt fine with the tool. However, I would rather not spawn a process to run the tool from my code.

My question is how do I generate/find that initialization vector. I am 99.9% sure it can be done from looking at other posts but I can't figure it out. I talked to the third party and they said they do not support that approach. Any help would be greatly appreciated.

A: 

See http://en.wikipedia.org/wiki/Block%5Fcipher%5Fmodes%5Fof%5Foperation for a description of the different modes of operation used in block ciphers. You don't need an initialization vector (IV) if you're using ECB mode which is just encrypting the message block by block. Maybe you have to check your DES library for setting ECB mode / disabling others.

If they aren't using ECB mode you need the IV, you can't "guess" it. The IV in most cases doesn't has to be secret, so it's not a problem to move it around.

svens