Skip to content

Conversation

kfrederix
Copy link
Contributor

When trying to use this class (in an old .Net 4.0 project), "SHA" + KeySize.ToString() evaluates to "SHAS256" (note the "S" in the middle) and subsequently HashAlgorithm.Create(AlgorithmName) evaluates to null because "SHAS256" is not a valid hash algorithm name.

By taking using the numeric value of KeySize (e.g. "SHA" + (int)KeySize) ) , AlgorithmName evaluates to "SHA256" and everything works.

When trying to use this class (in an old .Net 4.0 project), "SHA" + KeySize.ToString() evaluates to "SHAS256" (note the "S" in the middle) and subsequently HashAlgorithm.Create(AlgorithmName) evaluates to null because "SHAS256" is not a valid hash algorithm name. By taking using the numeric value of KeySize (e.g. "SHA" + (int)KeySize) ) , AlgorithmName evaluates to "SHA256" and everything works.
@codingstill
Copy link
Owner

The same issue exists in the SignerName property as well. Thanks for noticing

@codingstill codingstill merged commit 9e5df4a into codingstill:master Jun 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants