The public key has to be scrambled before being sent to the client.
It can be scrambled by doing the following:
1. Swap the first 4 bytes with the last 4 bytes
2. Xor first 64 bytes with last 64 bytes
3. Xor bytes 13 - 16 with bytes 52 - 56
4. Xor last 64 bytes with first 64 bytes
I have not had any luck using C#'s RSA functions to decrypt packets tho, but I haven't been working on it too hard as I got frustrated.
Only the public modulus is sent to the client as the client can use whatever exponent it wants to encrypt the packet, the exponent isn't used in the decryption process at all.
|