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:
authorAndreas Lindh <andreas.lindh@loopstone.com>2017-11-29 04:11:38 +0300
committerMarek Safar <marek.safar@gmail.com>2017-11-29 21:41:27 +0300
commit370fd7bb86338a89228d7397a32e7f34628c4d75 (patch)
tree1780ba79c0d8209bf29344c4f210faadabdd2d09 /mcs/class/System.IdentityModel
parentc5d3bf2428e042bc848bde3b64cb203c8b4538e5 (diff)
un-commented HmacSha256Signature bug 35661
Diffstat (limited to 'mcs/class/System.IdentityModel')
-rw-r--r--mcs/class/System.IdentityModel/System.IdentityModel.Tokens/InMemorySymmetricSecurityKey.cs5
-rw-r--r--mcs/class/System.IdentityModel/Test/System.IdentityModel.Tokens/InMemorySymmetricSecurityKeyTest.cs17
2 files changed, 20 insertions, 2 deletions
diff --git a/mcs/class/System.IdentityModel/System.IdentityModel.Tokens/InMemorySymmetricSecurityKey.cs b/mcs/class/System.IdentityModel/System.IdentityModel.Tokens/InMemorySymmetricSecurityKey.cs
index 014d8a70f7f..d0fe6750af7 100644
--- a/mcs/class/System.IdentityModel/System.IdentityModel.Tokens/InMemorySymmetricSecurityKey.cs
+++ b/mcs/class/System.IdentityModel/System.IdentityModel.Tokens/InMemorySymmetricSecurityKey.cs
@@ -123,8 +123,8 @@ namespace System.IdentityModel.Tokens
{
if (algorithm == SecurityAlgorithms.HmacSha1Signature)
return new HMACSHA1 (key);
- //if (algorithm == SecurityAlgorithms.HmacSha256Signature)
- // return new HMACSHA256 (key);
+ if (algorithm == SecurityAlgorithms.HmacSha256Signature)
+ return new HMACSHA256 (key);
throw new NotSupportedException ();
}
@@ -212,6 +212,7 @@ namespace System.IdentityModel.Tokens
{
switch (algorithm) {
case SecurityAlgorithms.HmacSha1Signature:
+ case SecurityAlgorithms.HmacSha256Signature:
case SecurityAlgorithms.Psha1KeyDerivation:
case SecurityAlgorithms.Aes128Encryption:
case SecurityAlgorithms.Aes128KeyWrap:
diff --git a/mcs/class/System.IdentityModel/Test/System.IdentityModel.Tokens/InMemorySymmetricSecurityKeyTest.cs b/mcs/class/System.IdentityModel/Test/System.IdentityModel.Tokens/InMemorySymmetricSecurityKeyTest.cs
index 7fa81a95abd..995301071c1 100644
--- a/mcs/class/System.IdentityModel/Test/System.IdentityModel.Tokens/InMemorySymmetricSecurityKeyTest.cs
+++ b/mcs/class/System.IdentityModel/Test/System.IdentityModel.Tokens/InMemorySymmetricSecurityKeyTest.cs
@@ -275,5 +275,22 @@ namespace MonoTests.System.IdentityModel.Tokens
Assert.IsFalse (key.IsSymmetricAlgorithm (SecurityAlgorithms.RsaOaepKeyWrap), "#3");
Assert.IsTrue (key.IsSymmetricAlgorithm (SecurityAlgorithms.Psha1KeyDerivation), "#4");
}
+
+ [Test]
+ public void GetKeyedHashAlgorithm()
+ {
+ InMemorySymmetricSecurityKey key = new InMemorySymmetricSecurityKey(new byte[0]);
+
+ Assert.That(() => key.GetKeyedHashAlgorithm(SecurityAlgorithms.HmacSha256Signature), Throws.Nothing);
+ }
+
+ [Test]
+ public void IsSupportedAlgorithm()
+ {
+ InMemorySymmetricSecurityKey key = new InMemorySymmetricSecurityKey(new byte[0]);
+
+ Assert.That(() => key.IsSupportedAlgorithm(SecurityAlgorithms.HmacSha256Signature), Is.True);
+ }
+
}
}