Reputation: 87187
I've enabled FIPS compliance mode in Windows 7, but now my code fails to compile with the following error:
Source file 'whatever.cs' could not be opened ('This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.')
I'm using SHA1 (hashing) and TripleDes (encryption) encryption. I also tried SHA512 and AES (256 bit key).
I can't get the project to build any more, but I need to compile it to use FIPS Compliant algorithms.
Upvotes: 6
Views: 14858
Reputation: 55427
Try making a blank C# app and compiling it, it should fail for the same reason. Ultimately the problem is Visual Studio, not your code. Follow the instructions here and add this to your IDE's config file (Devenv.exe.config
/VCSExpress.exe.config
/vbexpress.exe.config
):
<enforceFIPSPolicy enabled="false"/>
This doesn't mean that your app isn't running in FIPS compliant mode, it means that Visual Studio isn't now. Non-compliant code will still compile but if it tries to execute you'll receive an System.InvalidOperationException
exception.
I think, but don't know for sure, that the algorithms that VS uses to generate certain hashes in libraries isn't actually FIPS compliant.
Upvotes: 8
Reputation: 49978
This has a list of FIPS compliant algorithms. A more complete list is here
FIPS compliant Algorithms:
Hash algorithms
HMACSHA1
MACTripleDES
SHA1CryptoServiceProvider
Symmetric algorithms (use the same key for encryption and decryption)
DESCryptoServiceProvider
TripleDESCryptoServiceProvider
Asymmetric algorithms (use a public key for encryption and a private key for decryption)
DSACryptoServiceProvider
RSACryptoServiceProvider
So you will need to use SHA1CryptoServiceProvider
and TripleDESCryptoServiceProvider
to be FIPS compliant
Upvotes: 9
Reputation: 880
You can also try closing all open files in the IDE and then building. Someone wrote up the >issue recently at Microsoft Connect: connect.microsoft.com/VisualStudio/feedback/details/644602/… – indiv
That also worked for me with Visual Studio 2010. In my case I had to close all open files and also restart Visual Studio
Upvotes: 0