2010-02-19 58 views
5

如果在Windows中啓用「在FIPS中使用FIPS兼容算法進行加密,散列和簽名」安全策略選項,則嘗試在.NET Framework中使用許多加密類將導致InvalidOperationException。默認情況下,ASP.NET使用AES來加密ViewState blob,因此失敗。您可以解決此通過增加這樣一個關鍵的web.config:可以使ASP.NET ScriptManager與Windows FIPS安全策略一起使用嗎?

<machineKey validationKey="AutoGenerate,IsolateApps" decryptionKey="AutoGenerate,IsolateApps" validation="3DES" decryption="3DES"/> 

以及覆蓋你基本ASP.NET使用。我的問題是:我有大量複雜的ASP.NET Web應用程序,它們大量使用ScriptManager(ASP.NET AJAX的基礎),並且需要由必須啓用FIPS策略設置的政府客戶部署。上面有一個ScriptManager任何ASP.NET頁面拋出此異常:

[InvalidOperationException: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.] 
    System.Security.Cryptography.SHA1Managed..ctor() +3607454 
    System.Security.Policy.Hash.get_SHA1() +45 
    System.Web.Handlers.ScriptResourceHandler.GetAssemblyInfoInternal(Assembly assembly) +85 
    System.Web.Handlers.ScriptResourceHandler.GetAssemblyInfo(Assembly assembly) +99 
    System.Web.Handlers.RuntimeScriptResourceHandler.GetScriptResourceUrlImpl(List`1 assemblyResourceLists, Boolean zip, Boolean notifyScriptLoaded) +525 
    System.Web.Handlers.RuntimeScriptResourceHandler.System.Web.Handlers.IScriptResourceHandler.GetScriptResourceUrl(List`1 assemblyResourceLists, Boolean zip, Boolean notifyScriptLoaded) +910 
    System.Web.Handlers.RuntimeScriptResourceHandler.System.Web.Handlers.IScriptResourceHandler.GetScriptResourceUrl(Assembly assembly, String resourceName, CultureInfo culture, Boolean zip, Boolean notifyScriptLoaded) +193 
    System.Web.UI.ScriptReference.GetUrlFromName(ScriptManager scriptManager, IControl scriptManagerControl, Boolean zip) +306 
    System.Web.UI.ScriptManager.RegisterUniqueScripts(List`1 uniqueScripts) +169 
    System.Web.UI.ScriptManager.RegisterScripts() +407 
    System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +200 
    System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +11041982 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3672 

即使添加了<enforceFIPSPolicy enabled="false"/>元素的web.config不能解決例外。

有什麼辦法可以配置ASP.NET,使ScriptManager可以與Windows FIPS安全策略一起使用?從微軟

回答

3

更新:熱修復程序可在http://code.msdn.microsoft.com/KB981119

答案是,你不能啓用服務器FIPS使用的ScriptManager。 :(

類System.Web.Handlers.ScriptResourceHandler的靜態方法GetAssemblyInfo創建哈希對象不是FIPS兼容。這是淨3.5 SP1和.Net 3.51

(System.Web程序之間改變。擴展版本3.5.30729.196)
XP /2008分之2003的.Net 3.5 SP1

private static Pair<AssemblyName, DateTime> GetAssemblyInfoInternal(Assembly assembly) 
{ 
    return new Pair<AssemblyName, DateTime>(new AssemblyName(assembly.FullName), GetLastWriteTime(assembly)); 
} 

(System.Web.Extensions程序版本3.5.30729.4926)
的Win7/2008R2的.Net 3.51

private static Pair<AssemblyName, string> GetAssemblyInfoInternal(Assembly assembly) 
{ 
    AssemblyName first = new AssemblyName(assembly.FullName); 
    return new Pair<AssemblyName, string>(first, Convert.ToBase64String(new Hash(assembly).SHA1)); 
} 

很顯然,從時間日期戳到散列表的變化打破了FIPS合規性。我們已經與微軟展開了一個支持案例。

1

Microsoft已發佈一個修補程序來解決此問題:KB981119。我不認爲該修補程序是通過Microsoft網站公開提供的。

相關問題