FIPSAlgorithmPolicy
Windowsレジストリでが設定されている環境1
(具体的には、HKLM / SYSTEM / CurrentControlSet / Control / Lsa)で動作するようにWebアプリケーションを設定しようとしています。このフラグが有効になっている場合、クラスMD5CryptoServiceProvider
を呼び出すInvalid Operation Exception
と、次のスタックトレースでがスローされます。
[InvalidOperationException: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.]
System.Security.Cryptography.RijndaelManaged..ctor() +10480142
System.Web.Configuration.MachineKeySection.ConfigureEncryptionObject() +439
System.Web.Configuration.MachineKeySection.EnsureConfig() +152
System.Web.Configuration.MachineKeySection.GetEncodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32& length) +48
System.Web.UI.ObjectStateFormatter.Serialize(Object stateGraph) +381
System.Web.UI.Util.SerializeWithAssert(IStateFormatter formatter, Object stateGraph) +59
System.Web.UI.HiddenFieldPageStatePersister.Save() +89
System.Web.UI.Page.SaveAllState() +1117
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3864
この記事で読んだ内容に基づいて、構成ファイルに以下を追加して、アルゴリズムチェックを無効にできるはずです。
<configuration>
<runtime>
<enforceFIPSPolicy enabled="false"/>
</runtime>
</configuration>
これは、テストコンソールアプリケーションでapp.configを変更することで機能します。ただし、.NET2.0Webアプリケーションのweb.configを変更すると機能しないようです。
私にとって興味深いのは、MD5CryptoServiceProvider
inコードをインスタンス化するときにすべての例外をキャッチしているにもかかわらず、コードのその部分に到達していないように見えることです。これは私のテストアプリで呼び出されるコードです:
protected string printSomething()
{
string toPrint = String.Empty;
try
{
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
toPrint = "Created algorithm.";
}
catch (Exception e)
{
toPrint = e.ToString();
}
return toPrint;
}
そして、これは私がページにアクセスしたときに私が見るものです:
したがって、これによりいくつかの質問が発生します。
- アプリが例外をキャッチできるようにする代わりに、IISがYSODをスローするのはなぜですか?
- Webアプリで使用できるようにするには何をする必要があります
<enforceFIPSPolicy enabled="false"/>
か?