-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.Security.Cryptography.CryptographicException: 'The payload was invalid. For more information go to http://aka.ms/dataprotectionwarning' #39958
Comments
So, to mirror what I said in docs, the package was primarily meant for auth cookies, as a stop gap to help people migrate. This just reminds me to draw a line under it and mark it as unsupported and deprecated. What's the real-world scenario you're trying to solve here? |
I work in the financial industry, and lot of things in a sessions need to be encrypted - some data at rest as well. So we've used it a lot of just general encryption/decryption and data protection of the application. It's maybe not the best solution for the problem but it's been used now for almost 8 years and it works. The project currently is built in .NET FW 4.8. Recently I've been trying to figure out a pathway to migrate (slowly and safely) to .NET Core. Because the size of this project and how many teams I have working on it, the only realistic way to upgrade would be to build out a .NET Core project in parallel and move one API at a time. However, by doing that I need encryption to work the same in both applications. Do we use cookies? Yeah. But we just keep a SessionID in the cookie that corresponds to the session data on the server-side. Do we use view state? Not that I'm aware of. Eventually I'm going to convert all the data at rest that needs encryption into Key Vault. However, I'd still use DataProjection because there still is transient data during a session that, at times, needs to be encrypted - not a lot, but some. So this nuget package got me excited because it looked like a promising way for me to have the same Data Protection for both my apps (4.8, Core) while running them at the same time - but it doesn't work currently. |
Related: #40083 We'll probably see similar cases as we work on the migration epic in 7. |
Thanks for contacting us. We're moving this issue to the |
Dealing with this issue as well. This issue is a huge blocking problem and I find it very frustrating that it does not work. |
I just got this problem because I changed Kestrel initialisation to be able to use it from Windows service. .NET 6 project. I moved from
to
For my case the workaround was easy because I don't need to keep my protected storage.
The question is why protected storage is sensitive to my Kestrel init ? |
|
@wtgodbe Reassigning this to you to follow up. |
Thanks for contacting us. We're moving this issue to the |
So what's going on here? This exception has been happening since day 1 for me, requiring customers to clear their local storage. Is there a recommended way for SSB to set local storage values other than this? |
I'm wondering if there's been any movement on this issue. My team is currently migrating our net48 app to netcore. We plan having the netcore app and the net48 app running as a fallback. We'd want to be authenticate our servers for both apps. We're persisting our keys in an xml repository for key management. All of the configurations are identical but we're running in this issue as well. |
Closing as out of scope/unsupported use |
Is there an existing issue for this?
Describe the bug
There is a bug in the usage of the Microsoft.AspNetCore.DataProtection.SystemWeb nuget package.
I have a basic ASP.NET MVC .NET 4.8 project created using the examples in the article with the DataProtectionDemo.cs and using the Microsoft.AspNetCore.DataProtection.SystemWeb nuget package. I did everything exactly how the article described. Setup as follows:
-I created a basic .NET Core Console application injecting the IDataProtectionProvider and setting up the AddDataProjection() exactly how it was done in the first example (but in core).
If I protect a value (any value) on the ASP.NET site and try and unprotect that value on the console application I get the "The payload was invalid.". Either there missing information in that product article critical to getting this working, or there is a bug in the process. I've double-checked everything the article mentions.
keys are generated correctly in the same file location for both applications
application name is exactly the same in both applications (my-app)
I have generated a github repo reproducing the error here https://github.com/palmej2/DNETFW-2-DNETCORE
NOTE: This is issue originated from dotnet/AspNetCore.Docs#24847 and was directed to make bug
Expected Behavior
Anything encrypted in .NET FW 4.8 should be able to be decrypted and read in .NET as long as the same security keys are used in both applications.
Steps To Reproduce
Get https://github.com/palmej2/DNETFW-2-DNETCORE
Instructions to recreate issues found:
Currently #3 is failing, and it shouldn't fail. It should decrypt the value correctly, which currently should be "TEST VALUE".
Exceptions (if any)
System.Security.Cryptography.CryptographicException: 'The payload was invalid. For more information go to http://aka.ms/dataprotectionwarning'
.NET Version
4.8/6.0
Anything else?
No response
The text was updated successfully, but these errors were encountered: