Skip to content
This repository has been archived by the owner on Nov 22, 2018. It is now read-only.

Enable SHA256.Create() calls to work for desktop applications on FIPS compliant machines. #144

Closed
NTaylorMullen opened this issue Jun 2, 2017 · 2 comments
Assignees
Milestone

Comments

@NTaylorMullen
Copy link
Contributor

When unnetcoreappifying our libraries we didn't also enable our SHA256.Create() implementations to work under the desktop framework. To do this you need to change SHA256.Create() the to the following:

public static SHA256 CreateSHA256()
{
	SHA256 sha256;

	try
	{
		sha256 = SHA256.Create();
	}
	// SHA256.Create is documented to throw this exception on FIPS compliant machines.
	// See: https://msdn.microsoft.com/en-us/library/z08hz7ad%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
	catch (System.Reflection.TargetInvocationException)
	{
		// Fallback to a FIPS compliant SHA256 algorithm.
		sha256 = new SHA256CryptoServiceProvider();
	}

	return sha256;
}
@NTaylorMullen NTaylorMullen added this to the 2.0.0-preview2 milestone Jun 2, 2017
@NTaylorMullen NTaylorMullen removed this from the 2.0.0-preview2 milestone Jun 2, 2017
@DamianEdwards DamianEdwards added this to the 2.0.0-preview3 milestone Jun 6, 2017
@NTaylorMullen NTaylorMullen self-assigned this Jun 7, 2017
@NTaylorMullen
Copy link
Contributor Author

Self-assigned this because in order to verify I fixed MVC I need to also verify this.

@NTaylorMullen
Copy link
Contributor Author

bdf115a

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants