1

As I am trying to debug an issue with cookie sizes in my Asp.Net Core MVC application.

It would really help to see what is stored in the cookies that Asp.Net Core is making in my browser. (I think it would help me understand what is going on and thus help me figure out a fix.)

How can I take the cookie values found in the Chrome dev tools and decrypt them?

Do be clear, this is a screen shot of the data I want to decrypt:

Cookies To Decrypt

As an FYI, this is the issue I am having.

Update:

  • I was able to get the "key" using this code:

    services.AddDataProtection().PersistKeysToFileSystem(new DirectoryInfo(@"c:\path"));
    
  • Unfortunately, the "key" does not seem to follow the rules for AES encryption.

Vaccano
  • 78,325
  • 149
  • 468
  • 850
  • Not a full answer because it'd be quite a lot of work, but basically ASP.NET Core uses the configured DataProtection provider to encrypt cookies IIRC. Run your app locally and in the output window you should see some relevant Information-level logs from the Microsoft.AspNetCore namespace – Camilo Terevinto Dec 18 '20 at 18:46
  • @CamiloTerevinto - Hmmm, I don't think I configured any kind of DataProtection. Aside from the bit of code I am testing in regards to OIDC, my app is very bare bones. But I can take a look and see if I find anything in the logs. – Vaccano Dec 18 '20 at 18:54
  • I know you likely didn't, it gets [configured automatically](https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/introduction?view=aspnetcore-5.0#design-philosophy) – Camilo Terevinto Dec 18 '20 at 18:57

0 Answers0