2

I have one projected that generate bearer tokens via OAuth from MachineKey. Now I can't seem to find a way to decrypt this token in a .NET Core project since it uses DataProtector and the "Compability" guide seems to point towards something else.

And no, I don't want to replace the decrypt/encrypt mechanism for this. I want to decrypt the token used in .NET Core that is generated by OAuth in .NET Standard. This is not an option to make all tokens invalid.

What I've done from: https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/compatibility/replacing-machinekey?view=aspnetcore-2.1

Is add the MachineKey in Web.config and then added a new app-name. Then tried getting the DataProtector and trying to decrypt a token but what I get is:

CryptographicException: The provided payload cannot be decrypted because it was not protected with this protection provider.

So this does not seem like a .NET Standard -> .NET Core guide but the reverse?

How can the same token be encrypted with MachineKey and decrypted with DataProtector?

Deukalion
  • 2,516
  • 9
  • 32
  • 50

0 Answers0