Bug 35661 - SecurityAlgorithms.HmacSha256Signature is not supported by System.IdentityModel.Tokens.InMemorySymmetricSecurityKey
Summary: SecurityAlgorithms.HmacSha256Signature is not supported by System.IdentityMod...
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-11-08 07:33 UTC by af4178a2
Modified: 2017-11-29 19:01 UTC (History)
5 users (show)

See Also:
Is this bug a regression?: ---
Last known good build:

NUnit tests (652 bytes, text/x-csharp)
2015-11-08 07:33 UTC, af4178a2
Proposed patch (1.55 KB, patch)
2015-11-08 07:34 UTC, af4178a2
Details | Diff
Proposed patch (fixed) (795 bytes, patch)
2015-11-08 07:36 UTC, af4178a2
Details | Diff

Description af4178a2 2015-11-08 07:33:05 UTC
The method GetKeyedHashAlgorithm of InMemorySymmetricSecurityKey class with SecurityAlgorithms.HmacSha256Signature as argument throws System.NotSupportedException.

The code which creates the HMACSHA256 instance is commented out on mono master branch without any obvious reason: https://github.com/mono/mono/blob/master/mcs/class/System.IdentityModel/System.IdentityModel.Tokens/InMemorySymmetricSecurityKey.cs#L126

Also the method IsSupportedAlgorithm returns false when specifying SecurityAlgorithms.HmacSha256Signature.

HMACSHA256 is already properly supported by mono, therefore HMACSHA256 should be enabled for compatibility reasons.
Comment 1 af4178a2 2015-11-08 07:33:41 UTC
Created attachment 13720 [details]
NUnit tests
Comment 2 af4178a2 2015-11-08 07:34:29 UTC
Created attachment 13721 [details]
Proposed patch
Comment 3 af4178a2 2015-11-08 07:36:42 UTC
Created attachment 13722 [details]
Proposed patch (fixed)
Comment 4 Alex Regueiro 2017-09-06 18:14:43 UTC
Just curious, why hasn't this patch been merged yet? I'm running into this issue too.
Comment 5 Marek Safar 2017-09-07 09:03:29 UTC
Could you please convert your test and patch into Mono Pull Request

Thank you
Comment 6 Bernhard Urban 2017-11-29 19:01:04 UTC
fixed with https://github.com/mono/mono/pull/6130

Note You need to log in before you can comment on or make changes to this bug.