解决“This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms”

解决“This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms”

还是装那台服务器,装好了IIS和ASP.NET,但在运行aspx页面时出现了异常:
异常信息: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.
上网搜索一下,有以下几种方案:
1.用组策略编辑器关闭FIPS:gpedit.msc,改成禁用
这里写图片描述
结果:我的本来就是禁用,此方案无效。
2.将DOTNET Framework停用FIPS。
(1)修改Web.config增加

<configuration>
    <runtime>
        <enforceFIPSPolicy enabled="false"/>
    </runtime>
</configuration>

结果:无效
(2)修改C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config,增加与(1)相同的内容
结果:无效
3.修改注册表:
(1):HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa:FipsAlgorithmPolicy=0;
(2):HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy:enabled=0;
结果:我的(1)是1,(2)本来就是0,把(1)改成0后,问题解决

同时从网上找到了验证FIPS是否打开的代码(引用地址),贴在这里,如果执行结果中存在“N”的情况,则说明FIPS打开了:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Security.Cryptography;
namespace FIPS
{
    class Program
    {
        static void Main(string[] args)
        {
            Assembly core = Assembly.Load("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
            Assembly mscorlib = Assembly.Load("mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
            Type[] subclasses = new Type[]
            {
                typeof(SymmetricAlgorithm),
                typeof(HashAlgorithm),
                typeof(AsymmetricAlgorithm)
            };

            Print(mscorlib, subclasses);
            Console.WriteLine();
            Console.WriteLine();
            Print(core, subclasses);

            Console.Read();
        }

        private static void Print(Assembly asm, Type[] subclasses)
        {
            string columnFormat = "{0,-35}{1,-15}{2}";
            Console.WriteLine("FIPS Compliant in {0}", asm.GetName());
            Console.WriteLine(columnFormat, "Name", "Compliant", "Subclass");

            foreach (Type type in asm.GetTypes())
            {
                foreach (Type subclass in subclasses)
                {
                    if (type.IsSubclassOf(subclass))
                    {
                        if (!type.IsAbstract)
                        {
                            string isCompliant = null;
                            try
                            {
                                Activator.CreateInstance(type);
                                isCompliant = "Y";
                            }
                            catch (TargetInvocationException)
                            {
                                isCompliant = "N";
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine(e.Message);
                            }
                            finally
                            {
                                Console.WriteLine(
                                    columnFormat, type.Name, isCompliant, subclass.Name);
                            }
                        }
                    }
                }
            }
        }
    }
}

修改前执行结果:


FIPS Compliant in mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77
a5c561934e089
Name                               Compliant      Subclass
DESCryptoServiceProvider           Y              SymmetricAlgorithm
DSACryptoServiceProvider           Y              AsymmetricAlgorithm
HMACMD5                            N              HashAlgorithm
HMACRIPEMD160                      N              HashAlgorithm
HMACSHA1                           Y              HashAlgorithm
HMACSHA256                         N              HashAlgorithm
HMACSHA384                         N              HashAlgorithm
HMACSHA512                         N              HashAlgorithm
MACTripleDES                       Y              HashAlgorithm
MD5CryptoServiceProvider           N              HashAlgorithm
RC2CryptoServiceProvider           N              SymmetricAlgorithm
RIPEMD160Managed                   N              HashAlgorithm
RSACryptoServiceProvider           Y              AsymmetricAlgorithm
RijndaelManaged                    N              SymmetricAlgorithm
SHA1CryptoServiceProvider          Y              HashAlgorithm
SHA1Managed                        N              HashAlgorithm
SHA256Managed                      N              HashAlgorithm
SHA384Managed                      N              HashAlgorithm
SHA512Managed                      N              HashAlgorithm
TripleDESCryptoServiceProvider     Y              SymmetricAlgorithm


FIPS Compliant in System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=
b77a5c561934e089
Name                               Compliant      Subclass
AesCryptoServiceProvider           Y              SymmetricAlgorithm
AesManaged                         N              SymmetricAlgorithm
ECDiffieHellmanCng                 Y              AsymmetricAlgorithm
ECDsaCng                           Y              AsymmetricAlgorithm
MD5Cng                             N              HashAlgorithm
SHA1Cng                            Y              HashAlgorithm
SHA256Cng                          Y              HashAlgorithm
SHA256CryptoServiceProvider        Y              HashAlgorithm
SHA384Cng                          Y              HashAlgorithm
SHA384CryptoServiceProvider        Y              HashAlgorithm
SHA512Cng                          Y              HashAlgorithm
SHA512CryptoServiceProvider        Y              HashAlgorithm

修改后的执行结果:

FIPS Compliant in mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77
a5c561934e089
Name                               Compliant      Subclass
DESCryptoServiceProvider           Y              SymmetricAlgorithm
DSACryptoServiceProvider           Y              AsymmetricAlgorithm
HMACMD5                            Y              HashAlgorithm
HMACRIPEMD160                      Y              HashAlgorithm
HMACSHA1                           Y              HashAlgorithm
HMACSHA256                         Y              HashAlgorithm
HMACSHA384                         Y              HashAlgorithm
HMACSHA512                         Y              HashAlgorithm
MACTripleDES                       Y              HashAlgorithm
MD5CryptoServiceProvider           Y              HashAlgorithm
RC2CryptoServiceProvider           Y              SymmetricAlgorithm
RIPEMD160Managed                   Y              HashAlgorithm
RSACryptoServiceProvider           Y              AsymmetricAlgorithm
RijndaelManaged                    Y              SymmetricAlgorithm
SHA1CryptoServiceProvider          Y              HashAlgorithm
SHA1Managed                        Y              HashAlgorithm
SHA256Managed                      Y              HashAlgorithm
SHA384Managed                      Y              HashAlgorithm
SHA512Managed                      Y              HashAlgorithm
TripleDESCryptoServiceProvider     Y              SymmetricAlgorithm


FIPS Compliant in System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=
b77a5c561934e089
Name                               Compliant      Subclass
AesCryptoServiceProvider           Y              SymmetricAlgorithm
AesManaged                         Y              SymmetricAlgorithm
ECDiffieHellmanCng                 Y              AsymmetricAlgorithm
ECDsaCng                           Y              AsymmetricAlgorithm
MD5Cng                             Y              HashAlgorithm
SHA1Cng                            Y              HashAlgorithm
SHA256Cng                          Y              HashAlgorithm
SHA256CryptoServiceProvider        Y              HashAlgorithm
SHA384Cng                          Y              HashAlgorithm
SHA384CryptoServiceProvider        Y              HashAlgorithm
SHA512Cng                          Y              HashAlgorithm
SHA512CryptoServiceProvider        Y              HashAlgorithm
  • 3
    点赞
  • 0
    收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
评论

打赏作者

KingOf007

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值