|
-
November 1st, 2007, 12:27 AM
#1
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);
-
November 1st, 2007, 10:09 AM
#2
Re: How to do Tripple DES decryption in C#.
There is a good example in the TripleDESCryptoServiceProvider Class on MSDN (TripleDESCryptoServiceProvider Help) which is the wrapper class for TrippleDES.
Last edited by CJ1; November 1st, 2007 at 10:13 AM.
-
November 1st, 2007, 06:08 PM
#3
Re: How to do Tripple DES decryption in C#.
-
November 1st, 2007, 06:13 PM
#4
Re: How to do Tripple DES decryption in C#.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|