启用FIPS的服务器中的C#MD5哈希

时间:2017-02-15 16:33:09

标签: c# hash cmd md5 fips

我有一个C#网站,我需要为文件创建md5哈希值,但我的Web服务器已启用FIPS。由于服务器要求,更改为md5不是一个选项,并且出于某种原因将文件更改为FIPS,它也不在表中。

我可以创建一个小型桌面或命令应用程序,我可以手动设置哈希值吗?有没有办法完成这项任务?

2 个答案:

答案 0 :(得分:2)

Yeah this is important because sometimes you need to transfer passwords into the new format. I have a large database of user accounts that all use MD5, and our new server has FIPS enabled in secpol. So how can one verify that the user/pass combo provided is valid and needs converted, if one cannot create an MD5 hash...

I have found an alternative library to get the job done. https://rosettacode.org/wiki/MD5/Implementation#C.23

And you can source the additional required items from here: https://github.com/webbers/dongle.net/tree/master/src/Dongle/Criptography

答案 1 :(得分:1)

.net 4.8允许您选择退出“抛出异常”行为

<runtime>
<AppContextSwitchOverrides value="Switch.System.Security.Cryptography.UseLegacyFipsThrow=false" />
</runtime>

https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/retargeting/4.7.2-4.8