X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2Fcorlib%2FTest%2FSystem.Security.Cryptography%2FPaddingModeTest.cs;h=f06d90830d0c3f046812498ea294b91a58642066;hb=8f59998c4f744c7b78cf6cdd7f5849f99902c4b8;hp=ac7f4229cb80371226c1264500a7b159627991e2;hpb=af90548a08ef5effc93b083b7eec44daa178b141;p=mono.git diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/PaddingModeTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/PaddingModeTest.cs index ac7f4229cb8..f06d90830d0 100644 --- a/mcs/class/corlib/Test/System.Security.Cryptography/PaddingModeTest.cs +++ b/mcs/class/corlib/Test/System.Security.Cryptography/PaddingModeTest.cs @@ -5,7 +5,7 @@ // Sebastien Pouliot (sebastien@ximian.com) // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// Copyright (C) 2004, 2008 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -43,7 +43,7 @@ namespace MonoTests.System.Security.Cryptography { public void AssertEquals (string msg, byte[] array1, byte[] array2) { - AllTests.AssertEquals (msg, array1, array2); + Assert.AreEqual (array1, array2, msg); } protected byte[] CombineKeys (byte[] key1, byte[] key2, byte[] key3) @@ -997,6 +997,24 @@ namespace MonoTests.System.Security.Cryptography { Assert.AreEqual ("46-34-5C-8E-EB-DC-74-5C", MAC (PaddingMode.Zeros, 8)); Assert.AreEqual ("46-34-5C-8E-EB-DC-74-5C", MAC (PaddingMode.Zeros, 4)); } + + // https://bugzilla.novell.com/show_bug.cgi?id=366623 + + [Test] + public void ANSIX923_366623 () + { + TripleDES algo = GetTripleDES (); + algo.IV = new byte [algo.BlockSize >> 3]; + algo.Mode = CipherMode.ECB; + algo.Padding = PaddingMode.ANSIX923; + + ICryptoTransform enc = algo.CreateEncryptor (); + byte[] data = new byte [2] { 0xff, 0xff }; + byte[] encdata = enc.TransformFinalBlock (data, 0, 2); + ICryptoTransform dec = algo.CreateDecryptor (); + byte[] decdata = dec.TransformFinalBlock (encdata, 0, encdata.Length); + Assert.AreEqual (data, decdata); + } #endif } }