How to do Tripple DES decryption in C#.

Hi, i have a algorithm that processes some input byte as the following:

Output Byte = DES-1(keyLeft, DES(keyRight, DES-1(keyLeft, inputByte)))



i try to use c# TripleDES class decryptor method to implement this algo but no luck. I either get my exception error of "bad data" or there is no output from the method. So i wonder if anybody know how to do DES decryption in c#.

byte[] inputByte = new byte[8];

byte[] key = new byte[24];

byte[] initVal = new byte[8];

byte[] outputByte = new byte[8];

//////////////////////////////////////////

// Some inititalization of key and inputByte.
// Actual value not shown here.

input Byte = .....
key = .....

Array.clear(initVal, 0, 8);

//////////////////////////////////////////

TripleDES tdes = TripleDES.Create();

tdes.Key = key;
tdes.IV = initVal;

ICryptoTransform ict = tdes.CreateDecryptor();
tdes.Mode = CipherMode.ECB;

outputByte = ict.TransformFinalBlock(inputByte, 0, 8);
[1103 byte] By [Fugu13Young] at [2007-11-20 11:48:16]
# 1 Re: How to do Tripple DES decryption in C#.
There is a good example in the TripleDESCryptoServiceProvider Class on MSDN (TripleDESCryptoServiceProvider Help ( http://msdn2.microsoft.com/en-us/library/system.security.cryptography.tripledescryptoserviceprovider(VS.80).aspx)) which is the wrapper class for TrippleDES.
CJ1 at 2007-11-9 11:37:07 >
# 2 Re: How to do Tripple DES decryption in C#.
English is bad, but the code is good: http://www.codeproject.com/useritems/Encrypt_an_string.asp
Kensino at 2007-11-9 11:38:08 >
# 3 Re: How to do Tripple DES decryption in C#.
This is another good link: http://www.dev-archive.com/forum/misc.php?do=bbcode#code
Kensino at 2007-11-9 11:39:06 >