How to get at contents of Forms Authentication ticket with PHP

后端 未结 3 1683
情话喂你
情话喂你 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条回答
  •  清酒与你
    2021-01-07 11:46

    For anyone else wanting to do this, please note that the AES encryption used by ASP.NET is always of 16-byte block size, i.e. MCRYPT_RIJNDAEL_128 in PHP mcrypt terminology, and uses CBC mode. The key length (32 bytes / 256 bits by ASP.NET default) is determined by PHP from the actual key supplied. Also, the beginning of the decrypted data seems to become corrupted unless the IV is all zeros (i.e. "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0").

    For more information on decoding the data, see: http://www.codeproject.com/KB/aspnet/Forms_Auth_Internals.aspx

提交回复
热议问题