aspnet / AspNetKatana

Microsoft's OWIN implementation, the Katana project
Apache License 2.0
967 stars 334 forks source link

MachineKey.Unprotect failing #72

Closed fwhenin closed 4 years ago

fwhenin commented 7 years ago

Hi, I haven't been able to get past this point. we first found this issue when we realized the sliding expiration isn't working at all. brought the code in from Github to test and found that the MachineKey.Unprotect(protectedData, _purposes) is throwing a Cryptographic Exception with the message "Error occurred during a cryptographic operation". I tried using NEW Machine Keys with the same issue. also, the .Protect(userData, _purposes) method is running just fine. anybody see this issue?

KranthiKiranerusu commented 7 years ago

We are currently facing a similar issue with Machine.UnProtect on our webroles. We made sure that the same machine key and the purpose is used at all the webroles. We are using 3.0.0 of Microsoft.Owin.Host.SystemWeb But this error occurs intermittently. Any pointers what could be the issue?

Tratcher commented 7 years ago

Do you have multiple cookie middleware? It's possible the wrong one is trying to decrypt the cookie: https://github.com/aspnet/AspNetKatana/blob/8cda3619132b7d1c31392ccc38ef4bb6bac92a89/src/Microsoft.Owin.Security.Cookies/CookieAuthenticationMiddleware.cs#L45