I am trying to decrypt an authentication cookie set by another .NET 4.6.2 MVC app which was created with the following in the Startup.Auth:
TicketDataFormat = new AspNetTicketDataFormat(
new DataProtectorShim(
DataProtectionProvider.Create(new DirectoryInfo(@"C:\Keys\"))
.CreateProtector("blah")))
This is what I'm doing to try and decrypt it:
// Create a data protector to facilitate in decrypting the cookie.
var provider = DataProtectionProvider.Create(new DirectoryInfo(keyDirectory));
var dataProtector = provider.CreateProtector(dataProtectorPurpose);
// Decrypt the cookie, obtaining an authentication ticket.
var ticketDataFormat = new TicketDataFormat(dataProtector);
var ticket = ticketDataFormat.Unprotect(cookieValue);
This was working fine up until I started to do some Identity customisation. I have created a new IdentityUser which inherits from IdentityUser just so I can add a few extra fields. Is it failing to read the identity now maybe?
Thanks