Author: spouliot
Date: 2006-07-01 10:50:36 -0400 (Sat, 01 Jul 2006)
New Revision: 62171
Modified:
trunk/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog
trunk/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureDeformatterTest.cs
Log:
2006-07-01 Sebastien Pouliot <[EMAIL PROTECTED]>
* RSAPKCS1SignatureDeformatterTest.cs: Added test case where
SetHashAlgorithm isn't called and the hash algorithm name is derived
from the hash instance. From bug #78744 by Diego Mesa Tabares.
Modified: trunk/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog
2006-07-01 01:02:14 UTC (rev 62170)
+++ trunk/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog
2006-07-01 14:50:36 UTC (rev 62171)
@@ -1,3 +1,9 @@
+2006-07-01 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * RSAPKCS1SignatureDeformatterTest.cs: Added test case where
+ SetHashAlgorithm isn't called and the hash algorithm name is derived
+ from the hash instance. From bug #78744 by Diego Mesa Tabares.
+
2006-06-15 Sebastien Pouliot <[EMAIL PROTECTED]>
* HashAlgorithmTest.cs: Added new test cases wrt the output buffer
Modified:
trunk/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureDeformatterTest.cs
===================================================================
---
trunk/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureDeformatterTest.cs
2006-07-01 01:02:14 UTC (rev 62170)
+++
trunk/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureDeformatterTest.cs
2006-07-01 14:50:36 UTC (rev 62171)
@@ -5,12 +5,13 @@
// Sebastien Pouliot ([EMAIL PROTECTED])
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2004 Novell (http://www.novell.com)
+// Copyright (C) 2004-2006 Novell, Inc (http://www.novell.com)
//
using NUnit.Framework;
using System;
using System.Security.Cryptography;
+using System.Text;
namespace MonoTests.System.Security.Cryptography {
@@ -296,7 +297,7 @@
public void VerifySignatureHashNoKey ()
{
RSAPKCS1SignatureDeformatter fmt = new
RSAPKCS1SignatureDeformatter ();
- HashAlgorithm hash = hash = SHA1.Create ();
+ HashAlgorithm hash = SHA1.Create ();
try {
// no key
fmt.VerifySignature (hash, shaSignature);
@@ -414,5 +415,19 @@
Fail ("VerifySignatureMD5HashBadSignatureLength
- Expected CryptographicUnexpectedOperationException but got: " + e.ToString
());
}
}
+
+ [Test]
+ public void VerifySignatureWithoutCallingSetHashAlgorithm ()
+ {
+ string text = "text to sign";
+ RSA rsa = RSA.Create ();
+ RSAPKCS1SignatureFormatter fmt = new
RSAPKCS1SignatureFormatter (rsa);
+ SHA1 hash = SHA1.Create ();
+ hash.ComputeHash (Encoding.UTF8.GetBytes (text));
+ byte[] signature = fmt.CreateSignature (hash);
+
+ RSAPKCS1SignatureDeformatter def = new
RSAPKCS1SignatureDeformatter (rsa);
+ Assert ("Signature Ok", def.VerifySignature (hash,
signature));
+ }
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches