Please do not reply to this email- if you want to comment on the bug, go to the URL shown below and enter your comments there.
Changed by [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=80441 --- shadow/80441 2007-01-03 11:08:40.000000000 -0500 +++ shadow/80441.tmp.30517 2007-01-03 11:08:40.000000000 -0500 @@ -0,0 +1,62 @@ +Bug#: 80441 +Product: Mono: Class Libraries +Version: 1.2 +OS: +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Normal +Component: CORLIB +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: Case where successive decryption fails using same bytearray + +Description of Problem: +Decryption fails if input and output objects are the same ones, +given: +- you use default mode (CBC), +- default padding, +- and you do two successive decryptions. + +Unit test to reproduce: + [Test] + public void Transform2() + { + byte[] key = { 0, 1, 2, 3, 4, 5, 6, 7 }; + byte[] iv = { 0, 1, 2, 3, 4, 5, 6, 7 }; + byte[] expected = { 0xFF, 0x4B, 0x11, 0x74, 0xEF, 0x14, 0xC8, +0xE9,0x35, 0x20, 0xB2, 0x83, 0x76, 0x7F, 0xF0, 0xC4,0xFF, 0x4A, 0x13, 0x77, +0xEB, 0x11, 0xCE, 0xEE, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, +0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, +0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; + byte[] input = { 0x2A, 0xA2, 0x2A, 0xF4, 0x4E, 0x52, 0xBA, +0xD5, 0x1A, 0x64, 0x5A, 0xD3, 0x9D, 0xA5, 0x6D, 0x45, 0x37, 0xF3, 0x2C, +0x41, 0x60, 0x1E, 0xB , 0x49, 0x66, 0x3 , 0xC8, 0xAC, 0xA7, 0x58, 0x60, +0xD4, 0x1F, 0x1C, 0xB5, 0xB6, 0xAB, 0xA2, 0xC8, 0xE8, 0xB9, 0xD1, 0x14, +0x94, 0x28, 0x8E, 0x36, 0x90, 0x3 , 0xBA, 0xB7, 0xBE, 0x33, 0xBC, 0x68, +0xED, 0x2A, 0xDE, 0x6A, 0x4F, 0x4E, 0x4C, 0x26, 0xFB}; + DES des = DES.Create(); + byte[] result = new byte[64]; // could have been 56, see bug 80439 + ICryptoTransform decryptor = des.CreateDecryptor(key, iv); + + int len = decryptor.TransformBlock(input, 0, input.Length, +result, 0); + Assert.IsTrue(len == 56, "1st transform"); + len = decryptor.TransformBlock(result, 0, len, result, 0); + Assert.IsTrue(len == 56, "2nd transform"); + Assert.AreEqual(result, expected, "wrong ouput data"); + } + +Actual Results: +decrypted data differ from expected ones + +Additional Information: +Test fails under M$ too, yet with a different output. It seems their +implementation is buggy too, as soon as you use same object as input and +output. But I let you send the bug to them... +I still have a doubt with this test. Let me know if it's invalid. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
