-
Couldn't load subscription status.
- Fork 5.2k
Description
This was initially reported at https://stackoverflow.com/questions/79392501/whats-so-dangerous-about-pkcs12loaderlimits-dangerousnolimits
This person reported a CryptographicException from here:
Line 110 in f1901a0
| _ => throw new CryptographicException(), |
Which in theory should not be possible to hit, as the list of hash algorithms is closed and validated here:
runtime/src/libraries/Common/src/System/Security/Cryptography/Asn1/Pkcs12/PfxAsn.manual.cs
Line 80 in f1901a0
| if (!hmac.TryGetHashAndReset(derived, out int bytesWritten) || bytesWritten != expectedOutputSize) |
However, in this shim, it as asking IncrementalHash "What is your algorithm name?". IncrementalHash prepends "HMAC" in front of the algorithm names:
Line 43 in f1901a0
| _algorithmName = new HashAlgorithmName("HMAC" + name.Name); |
IncrementalHash answers with an algorithm of "HMACSHA1", not "SHA1" (for example). The switch in the shim does not handle the algorithm names that are prepended.
This only happens for the .NET Standard 2.0 build.