1

Say I have some Form's authentication Cookie:

FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
  "TESTTEST",
  DateTime.Now,
  DateTime.Now.AddMinutes(30),
  false,
  String.Empty,
  FormsAuthentication.FormsCookiePath);

Normally in C# we can decrypt this like so:

var authToken = FormsAuthentication.Decrypt(authCookie.Value);

I'm creating a tool for testing an I want to decrypt the cookie on the client-side.

If my machine key is: GHFDK45sDFGSKj234 How can I decrypt the Authentication from Javascript?

7
  • 1
    First you need to know the algorithm that the forms authentication is using. Then you need to find a javascript library that can decrypt that algorithm. Commented May 10, 2017 at 18:48
  • Thanks, I was trying to find that, so you can specify the encryption, and it defaults to SHA1 Commented May 10, 2017 at 18:50
  • @CallbackKid if you post that as an answer I'll mark it correct Commented May 10, 2017 at 18:50
  • no answers so far stackoverflow.com/questions/9651618/… Commented May 10, 2017 at 19:02
  • @VinodSrivastav yeah that was my mistake the SHA-1 is for tampervalidation, I think the encryption is AES Commented May 10, 2017 at 19:08

1 Answer 1

1

First you need to know the algorithm that the forms authentication is using. Then you need to find a javascript library that can decrypt that algorithm

Sign up to request clarification or add additional context in comments.

2 Comments

Is this cookie even javascript accessible? Do we really want to have the machine keys available to a web client?
@MadMyche He says he's creating a testing tool. I doubt this will be in his production environment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.