我们的团队在我们的服务器中使用ADAL 2.12时遇到了问题,这些服务器需要启用FIPS。这是抛出的异常:
System.Reflection.TargetInvocationException:调用目标抛出了异常。 ---> System.InvalidOperationException:此实现不是Windows平台FIPS验证的加密算法的一部分。 在System.Security.Cryptography.SHA256Managed..ctor() ---内部异常堆栈跟踪结束--- 在Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext.RunAsyncTask [T](任务`1任务) 在Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext.AcquireToken(String resource,ClientCredential clientCredential)
我还在调试器中捕获了原始异常,并发现了更详细的堆栈跟踪:
mscorlib.dll!System.Security.Cryptography.SHA256Managed.SHA256Managed()+ 0xcf bytes
[原产于管理过渡]
mscorlib.dll!System.Security.Cryptography.CryptoConfig.CreateFromName(string name,object [] args)+ 0x46b bytes mscorlib.dll!System.Security.Cryptography.SHA256.Create(string hashName)+ 0xb bytes
Microsoft.IdentityModel.Clients.ActiveDirectory.dll!Microsoft.IdentityModel.Clients.ActiveDirectory.PlatformSpecificHelper.CreateSha256Hash(字符串输入)+ 0x41字节
Microsoft.IdentityModel.Clients.ActiveDirectory.dll!Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenHandlerBase.LogReturnedToken(Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult result)+ 0x91 bytes
Microsoft.IdentityModel.Clients.ActiveDirectory.dll!Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenHandlerBase.PostRunAsync(Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult result)+ 0x32 bytes
Microsoft.IdentityModel.Clients.ActiveDirectory.dll!Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenHandlerBase.RunAsync.MoveNext()+ 0xdf6 bytes
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start(ref Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenHandlerBase.RunAsync stateMachine)+ 0x161 bytes
Microsoft.IdentityModel.Clients.ActiveDirectory.dll!Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenHandlerBase.RunAsync()+ 0x13a bytes
Microsoft.IdentityModel.Clients.ActiveDirectory.dll!Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext.AcquireTokenForClientCommonAsync.MoveNext()+ 0x130 bytes mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start(ref Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext.AcquireTokenForClientCommonAsync stateMachine)+ 0x171 bytes
Microsoft.IdentityModel.Clients.ActiveDirectory.dll!Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext.AcquireTokenForClientCommonAsync(string resource,Microsoft.IdentityModel.Clients.ActiveDirectory.ClientKey clientKey,bool callSync)+ 0x17e bytes
Microsoft.IdentityModel.Clients.ActiveDirectory.dll!Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext.AcquireToken(string resource,Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential clientCredential)+ 0x7d bytes
有没有办法解决这个问题?从通过反射器查看代码,似乎需要更新ADAL库本身来解决这个问题。
答案 0 :(得分:1)
感谢您报告此事。我们为它打开了一个错误,并将在我们的下一个服务版本中解决它,这将在几天后发布。这是GitHub上的错误:
https://github.com/AzureAD/azure-activedirectory-library-for-dotnet/issues/132