How do you use FIPS validated cryptographic algorithms with Visual Studio 2010 and Windows 7?

混江龙づ霸主 提交于 2019-12-19 03:08:07

问题


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.


回答1:


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.




回答2:


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




回答3:


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



来源:https://stackoverflow.com/questions/5034526/how-do-you-use-fips-validated-cryptographic-algorithms-with-visual-studio-2010-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!