Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Matos <joao@tritao.eu>2015-02-12 19:46:00 +0300
committerJoão Matos <joao@tritao.eu>2015-02-12 19:46:00 +0300
commit98a88d800913dff072daea6c7258913eea13f7c4 (patch)
treeedd54de53d285912266a3e1b7007e74f493ed25e /mcs/class/corlib
parent72eb18f84d645986985c7eba211136ae6be493a0 (diff)
parent789d43622e06ae836ff3abd8c70cfe480a69565c (diff)
Merge pull request #1534 from haf/bugs/hmac-wrong-keysizes
Bugs/hmac wrong keysizes
Diffstat (limited to 'mcs/class/corlib')
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/HMACRIPEMD160.cs2
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/HMACSHA1.cs2
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/HMACSHA256.cs2
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/HMACSHA384.cs2
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/HMACSHA512.cs2
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/HMACRIPEMD160Test.cs2
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA1Test.cs1
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA256Test.cs2
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA384Test.cs1
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA512Test.cs1
10 files changed, 12 insertions, 5 deletions
diff --git a/mcs/class/corlib/System.Security.Cryptography/HMACRIPEMD160.cs b/mcs/class/corlib/System.Security.Cryptography/HMACRIPEMD160.cs
index 38bf12b7a9d..f36b8336ba7 100644
--- a/mcs/class/corlib/System.Security.Cryptography/HMACRIPEMD160.cs
+++ b/mcs/class/corlib/System.Security.Cryptography/HMACRIPEMD160.cs
@@ -38,7 +38,7 @@ namespace System.Security.Cryptography {
public class HMACRIPEMD160 : HMAC {
public HMACRIPEMD160 ()
- : this (KeyBuilder.Key (8))
+ : this (KeyBuilder.Key (64))
{
}
diff --git a/mcs/class/corlib/System.Security.Cryptography/HMACSHA1.cs b/mcs/class/corlib/System.Security.Cryptography/HMACSHA1.cs
index baf644a6ab1..c5285cd359e 100644
--- a/mcs/class/corlib/System.Security.Cryptography/HMACSHA1.cs
+++ b/mcs/class/corlib/System.Security.Cryptography/HMACSHA1.cs
@@ -52,7 +52,7 @@ namespace System.Security.Cryptography {
public class HMACSHA1 : HMAC {
public HMACSHA1 ()
- : this (KeyBuilder.Key (8))
+ : this (KeyBuilder.Key (64))
{
}
diff --git a/mcs/class/corlib/System.Security.Cryptography/HMACSHA256.cs b/mcs/class/corlib/System.Security.Cryptography/HMACSHA256.cs
index 14c208d1fcf..0682438d445 100644
--- a/mcs/class/corlib/System.Security.Cryptography/HMACSHA256.cs
+++ b/mcs/class/corlib/System.Security.Cryptography/HMACSHA256.cs
@@ -38,7 +38,7 @@ namespace System.Security.Cryptography {
public class HMACSHA256 : HMAC {
public HMACSHA256 ()
- : this (KeyBuilder.Key (8))
+ : this (KeyBuilder.Key (64))
{
}
diff --git a/mcs/class/corlib/System.Security.Cryptography/HMACSHA384.cs b/mcs/class/corlib/System.Security.Cryptography/HMACSHA384.cs
index a25b0e71f4e..2ff07ee0fa7 100644
--- a/mcs/class/corlib/System.Security.Cryptography/HMACSHA384.cs
+++ b/mcs/class/corlib/System.Security.Cryptography/HMACSHA384.cs
@@ -49,7 +49,7 @@ namespace System.Security.Cryptography {
#endif
public HMACSHA384 ()
- : this (KeyBuilder.Key (8))
+ : this (KeyBuilder.Key (128))
{
}
diff --git a/mcs/class/corlib/System.Security.Cryptography/HMACSHA512.cs b/mcs/class/corlib/System.Security.Cryptography/HMACSHA512.cs
index 2f7c16632a1..abfe523a538 100644
--- a/mcs/class/corlib/System.Security.Cryptography/HMACSHA512.cs
+++ b/mcs/class/corlib/System.Security.Cryptography/HMACSHA512.cs
@@ -49,7 +49,7 @@ namespace System.Security.Cryptography {
#endif
public HMACSHA512 ()
- : this (KeyBuilder.Key (8))
+ : this (KeyBuilder.Key (128))
{
}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/HMACRIPEMD160Test.cs b/mcs/class/corlib/Test/System.Security.Cryptography/HMACRIPEMD160Test.cs
index ecb745aab2f..89d08fbf39a 100644
--- a/mcs/class/corlib/Test/System.Security.Cryptography/HMACRIPEMD160Test.cs
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/HMACRIPEMD160Test.cs
@@ -416,12 +416,14 @@ namespace MonoTests.System.Security.Cryptography {
[Test]
public void Invariants ()
{
+ var hmac = new HMACRIPEMD160 ();
Assert.IsTrue (hmac.CanReuseTransform, "HMACRIPEMD160.CanReuseTransform");
Assert.IsTrue (hmac.CanTransformMultipleBlocks, "HMACRIPEMD160.CanTransformMultipleBlocks");
Assert.AreEqual ("RIPEMD160", hmac.HashName, "HMACRIPEMD160.HashName");
Assert.AreEqual (160, hmac.HashSize, "HMACRIPEMD160.HashSize");
Assert.AreEqual (1, hmac.InputBlockSize, "HMACRIPEMD160.InputBlockSize");
Assert.AreEqual (1, hmac.OutputBlockSize, "HMACRIPEMD160.OutputBlockSize");
+ Assert.AreEqual (64, hmac.Key.Length, "HMACRIPEMD160.Key.Length");
Assert.AreEqual ("System.Security.Cryptography.HMACRIPEMD160", hmac.ToString (), "HMACRIPEMD160.ToString()");
}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA1Test.cs b/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA1Test.cs
index 0227a7b70fc..7245db51368 100644
--- a/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA1Test.cs
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA1Test.cs
@@ -88,6 +88,7 @@ public class HMACSHA1Test : KeyedHashAlgorithmTest {
Assert.AreEqual (160, algo.HashSize, "HMACSHA1.HashSize");
Assert.AreEqual (1, algo.InputBlockSize, "HMACSHA1.InputBlockSize");
Assert.AreEqual (1, algo.OutputBlockSize, "HMACSHA1.OutputBlockSize");
+ Assert.AreEqual (64, algo.Key.Length, "HMACSHA1.Key.Length");
Assert.AreEqual ("System.Security.Cryptography.HMACSHA1", algo.ToString (), "HMACSHA1.ToString()");
}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA256Test.cs b/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA256Test.cs
index abcf01f70c8..4dc50668ab9 100644
--- a/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA256Test.cs
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA256Test.cs
@@ -68,12 +68,14 @@ namespace MonoTests.System.Security.Cryptography {
[Test]
public void Invariants ()
{
+ var algo = new HMACSHA256 ();
Assert.IsTrue (algo.CanReuseTransform, "HMACSHA256.CanReuseTransform");
Assert.IsTrue (algo.CanTransformMultipleBlocks, "HMACSHA256.CanTransformMultipleBlocks");
Assert.AreEqual ("SHA256", algo.HashName, "HMACSHA256.HashName");
Assert.AreEqual (256, algo.HashSize, "HMACSHA256.HashSize");
Assert.AreEqual (1, algo.InputBlockSize, "HMACSHA256.InputBlockSize");
Assert.AreEqual (1, algo.OutputBlockSize, "HMACSHA256.OutputBlockSize");
+ Assert.AreEqual (64, algo.Key.Length, "HMACSHA256.Key.Length");
Assert.AreEqual ("System.Security.Cryptography.HMACSHA256", algo.ToString (), "HMACSHA256.ToString()");
}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA384Test.cs b/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA384Test.cs
index 6877448cad9..3701c21ddc6 100644
--- a/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA384Test.cs
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA384Test.cs
@@ -89,6 +89,7 @@ namespace MonoTests.System.Security.Cryptography {
Assert.AreEqual (384, algo.HashSize, "HMACSHA384.HashSize");
Assert.AreEqual (1, algo.InputBlockSize, "HMACSHA384.InputBlockSize");
Assert.AreEqual (1, algo.OutputBlockSize, "HMACSHA384.OutputBlockSize");
+ Assert.AreEqual (128, algo.Key.Length, "HMACSHA384.Key.Length");
Assert.AreEqual ("System.Security.Cryptography.HMACSHA384", algo.ToString (), "HMACSHA384.ToString()");
}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA512Test.cs b/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA512Test.cs
index 55a7b87589c..4eb4f4446dc 100644
--- a/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA512Test.cs
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA512Test.cs
@@ -88,6 +88,7 @@ namespace MonoTests.System.Security.Cryptography {
Assert.AreEqual (512, algo.HashSize, "HMACSHA512.HashSize");
Assert.AreEqual (1, algo.InputBlockSize, "HMACSHA512.InputBlockSize");
Assert.AreEqual (1, algo.OutputBlockSize, "HMACSHA512.OutputBlockSize");
+ Assert.AreEqual (128, algo.Key.Length, "HMACSHA512.Key.Length");
Assert.AreEqual ("System.Security.Cryptography.HMACSHA512", algo.ToString (), "HMACSHA512.ToString()");
}