The encrypt data is in the main flash file(client.swf).It's using AES-128-CBC.The key is changeless and written in the client.The server will transmit the encrypted data and iv.
Here is the decrypt program written in C#.
====Code Start====
===AESDecrypt.cs===
using System;
using System.Security.Cryptography;
using System.Text;
namespace ToukenFiddlerTest
{
static class AESDecrypt
{
public static byte[] HexStringToByteArray(string hex)
{
int i;
byte[] outData = new byte[hex.Length / 2];
for (i = 0; i < hex.Length / 2; i++)
{
outData[i] = Convert.ToByte(hex.Substring(i * 2, 2), 16);
}
return outData;
}
public static string DoDecrypt(byte[] text, byte[] iv, byte[] key)
{
RijndaelManaged rijndaelCipher = new RijndaelManaged();
rijndaelCipher.Mode = CipherMode.CBC;
rijndaelCipher.Padding = PaddingMode.Zeros;
rijndaelCipher.KeySize = 128;
rijndaelCipher.BlockSize = 128;
rijndaelCipher.Key = key;
rijndaelCipher.IV = iv;
ICryptoTransform transform = rijndaelCipher.CreateDecryptor();
byte[] plainText = transform.TransformFinalBlock(text,0,text.Length);
return Encoding.UTF8.GetString(plainText);
}
}
}
===Section End===
===Program.cs===
...
if (api == "/battle/battle")
jsonData = AESDecrypt.DoDecrypt(AESDecrypt.HexStringToByteArray(jsonData["data"].ToString()), AESDecrypt.HexStringToByteArray(jsonData["iv"].ToString()), Encoding.UTF8.GetBytes("9ij8pNKv7qVJnpj4")));
...
===Section End===
====Code End====
English block...?あ
- whc
- 2016/06/06 (Mon) 16:35:10