有一个.net核心3.0Web应用程序,里面有IdentityServe4。应用程序托管在Azure Web场上。在日志中,我发现了该消息的少数例外情况:
异常读取受保护的消息-提供的有效负载无法解密,因为它没有受到此保护提供程序的保护。
RequestPath:/connect/endsession/callback
堆栈跟踪:
System.Security.Cryptography.CryptographicException:
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore
(Microsoft.AspNetCore.DataProtection, Version=3.1.8.0, Culture=neutral,
PublicKeyToken=adb9793829ddae60)
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.DangerousUnprotect
(Microsoft.AspNetCore.DataProtection, Version=3.1.8.0, Culture=neutral,
PublicKeyToken=adb9793829ddae60)
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect
(Microsoft.AspNetCore.DataProtection, Version=3.1.8.0, Culture=neutral,
PublicKeyToken=adb9793829ddae60)
at IdentityServer4.Stores.ProtectedDataMessageStore`1.ReadAsync (IdentityServer4, Version=3.1.3.0,
Culture=neutral, PublicKeyToken=f294d0afe402bb2b)数据保护设置:
services.AddDataProtection()
.PersistKeysToAzureBlobStorage(container, keyStorage.Path)
.ProtectKeysWithAzureKeyVault(client, keyEncryption.KeyIdentifier)最近,我们增加了services.AddOidcStateDataFormatterCache(schemes);和SQL Distributed缓存实现。
有人知道为什么会出现这种异常,以及如何解决吗?
发布于 2020-10-12 14:11:37
创建数据保护API密钥的代码可能被更改了吗?您有许多应用程序使用相同的密钥环存储吗?
我刚刚在博客中谈到了如何使用数据保护API,以及如何在Azure密钥库中存储密钥环:
https://stackoverflow.com/questions/64314905
复制相似问题