加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 联合身份验证和“加密操作期间发生错误”

发布时间:2020-12-16 00:27:47 所属栏目:asp.Net 来源:网络整理
导读:当我尝试在ASP.NET MVC应用程序上获得我的主页时,我收到了这个异常。 [CryptographicException: Error occurred during a cryptographic operation.] System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.HomogenizeErrors(Func`2 func,Byt
当我尝试在ASP.NET MVC应用程序上获得我的主页时,我收到了这个异常。

[CryptographicException: Error occurred during a cryptographic
operation.]
System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.HomogenizeErrors(Func`2
func,Byte[] input) +246
System.IdentityModel.Services.MachineKeyTransform.Decode(Byte[]
encoded) +191
System.IdentityModel.Tokens.SessionSecurityTokenHandler.ApplyTransforms(Byte[]
cookie,Boolean outbound) +173
System.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(XmlReader
reader,SecurityTokenResolver tokenResolver) +756
System.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(Byte[]
token,SecurityTokenResolver tokenResolver) +100
System.IdentityModel.Services.SessionAuthenticationModule.ReadSessionTokenFromCookie(Byte[]
sessionCookie) +1164
System.IdentityModel.Services.SessionAuthenticationModule.TryReadSessionTokenFromCookie(SessionSecurityToken&
sessionToken) +287
System.IdentityModel.Services.SessionAuthenticationModule.OnAuthenticateRequest(Object
sender,EventArgs eventArgs) +231
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+80 System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously) +165

从我理解的事情在SessionAuthenticationModule的cookie中出错。如果你清除cookies(如这里已经说明的那样),它可以工作。我想要了解发生了什么,如何解决异常并解决问题。

解决方法

该cookie在发布时包含使用当前machineKey加密的安全令牌。当前一个构建的cookie被发送回服务器时,SAM(更确切地说,令牌处理程序)尝试使用导致错误的machineKey的新值对其进行解密。
检查我的答案在相关的帖子( Federated Authentication on Azure)以减轻错误。 HTH

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读