How to get at contents of Forms Authentication ticket with PHP

后端 未结 3 1722
情话喂你
情话喂你 2021-01-07 11:17

I need to undo the following ASP.Net processes in PHP so I can get at the username and expiration date in a ticket. I\'ve decrypted the 3DES encryption (step 3 below) but I\

3条回答
  •  猫巷女王i
    2021-01-07 11:36

    I've been working it out, and I have managed to get the forms authentication ticket contents in PHP.

    1. Decrypt the ticket with the same key used to encrypt it on the .Net side. For this, I'm using http://www.navioo.com/php/docs/function.mcrypt-encrypt.php.

    2. The decryption adds padding to the end of the string, I remove that.

    3. I'm left with a string with a 20 byte SHA1 hash at the end. Those last 20 bytes (should) match the SHA1 hash of the first part of the string (string length - 20 bytes). I'm still working on this part, trying to figure out how .NET converts a byte array into a single clump of data that can be SHA1 hashed (so I can do the same on the PHP side).

    That's really all there is to it.

提交回复
热议问题