Is Forms Authentication Ticket Decryption possible with PHP?

后端 未结 4 992
鱼传尺愫
鱼传尺愫 2020-12-17 06:05

I\'m a PHP developer who knows almost nothing about .NET. I\'ve been asked by the .NET guys at work to translate .NET code that decrypts an authentication ticket into PHP so

4条回答
  •  星月不相逢
    2020-12-17 06:46

    As Gumbo said, you need to take into account the algorithms involved. The asp.net authentication ticket uses:

    1. Create a serialized forms authentication ticket. A byte array representation of the ticket is created.
    2. Sign the forms authentication ticket. The message authentication code (MAC) value for the byte array is computed by using the algorithm and key specified by the validation and validationKey attributes of the machineKey element. By default, the SHA1 algorithm is used.
    3. Encrypt forms authentication ticket. The second byte array that has been created is encrypted by using the Encrypt method of the FormsAuthentication class. The Encrypt method internally uses the algorithm and key specified by the decryption and decryptionKey attributes on the machineKey element. ASP.NET version 1.1 uses the 3DES algorithm by default. ASP.NET version 2.0 uses the Rinjdael (AES) algorithm by default.

提交回复
热议问题