Custom source

04/02/2012 00:23 kill_acvc#1
#Never mind, solved.
To those who replied, thanks.
04/02/2012 02:22 pro4never#2
What patch are you trying to work with? Encryptions have all changed including the exchange sequence.

Really depends on what patch you're trying to work with. If you're getting disconnected when you try to send server key packet then you are either encrypting it incorrectly, using the wrong encryption key, etcetc.
04/02/2012 02:47 kill_acvc#3
Quote:
Originally Posted by pro4never View Post
What patch are you trying to work with? Encryptions have all changed including the exchange sequence.

Really depends on what patch you're trying to work with. If you're getting disconnected when you try to send server key packet then you are either encrypting it incorrectly, using the wrong encryption key, etcetc.
I'm working with patch 5517 and I was following your guide.



[Only registered and activated users can see links. Click Here To Register...]



I think the problem is may be the encryption.. let me describe how I'm encrypting it.

First : When the client connects to the game server I initialize a "Client" instance which uses "Wrapper" class as argument.

Second : This calls the default constructor for the "Client" class, method in which the variables concerning game encryption are initialized, that is, "GameCryptography" and "DHKeyExchange.ServerKeyExchange" class.


[Only registered and activated users can see links. Click Here To Register...]


Oh and my CPU is 64 bits. I tried compiling in 64 bits but the result was the same.

[Edit]

Also, I think this may help : [Only registered and activated users can see links. Click Here To Register...]
04/02/2012 21:06 Spirited#4
It's not using Blowfish anymore. The client's DH Key has changed and the game cipher is now Cast-128. That changed happened on patch 5509.

[Only registered and activated users can see links. Click Here To Register...]
04/03/2012 03:26 kill_acvc#5
Quote:
Originally Posted by Fаng View Post
It's not using Blowfish anymore. The client's DH Key has changed and the game cipher is now Cast-128. That changed happened on patch 5509.

[Only registered and activated users can see links. Click Here To Register...]

Thanks. If it weren't by you I'd still be stuck at that stage. However, I've found myself into another situation now =P. If it's not asking too much :

- My recieve handler.
Code:
void OnRecieve(byte[] arg1, Wrapper arg2, byte[] arg3)
        {
            Client GameClient = (Client)arg2.connector;
            if(GameClient.HasExchangedKeys)
                EntryPoint.DebugPrint("Server has recieved non-dh packet!");
            GameClient.GameCryptography.Decrypt(arg1);
            if (!GameClient.HasExchangedKeys)
            {                
                    byte[] Data = arg1;
                    MemoryStream MS = new MemoryStream(Data);
                    BinaryReader BR = new BinaryReader(MS);
                    BR.ReadBytes(7);
                    uint PacketLen = BR.ReadUInt32();
                    int JunkLen = BR.ReadInt32();
                    BR.ReadBytes(JunkLen);
                    int Len = BR.ReadInt32();
                    string PubKey = ASCIIEncoding.ASCII.GetString(BR.ReadBytes(Len));
                    //remove from ConectionQueue and add to ConnectedClients.
                    EntryPoint.DebugPrint("Recieved DHKEY : " + PubKey);
                    GameClient.GameCryptography = GameClient.KeyExchange.HandleClientKeyPacket(PubKey, GameClient.GameCryptography);
                    BR.Close();
                    MS.Close();
                    GameClient.HasExchangedKeys = true;
                    if (ConnectedClients.ContainsKey(arg2._socket))
                    {
                        ConnectedClients.Remove(GameClient.Socket);
                        ConnectedClients.Add(GameClient.Socket, GameClient);
                    }
                    else
                    {
                        ConnectedClients.Add(GameClient.Socket, GameClient);
                    }
                    
            }
            else
            {
                GameClient = (Client)ConnectedClients[arg2._socket];
                //Size
                //Type
                byte[] Data = arg1;
                ushort Size = PacketReader.ReadUInt16(Data, 0);
                ushort Type = PacketReader.ReadUInt16(Data, 2);
                EntryPoint.DebugPrint("[Analysis]Recieved packet Size[Read size :" + Size.ToString() + " // Actual size: "+Data.Length+"] Type[" + Type.ToString() + "] .");
                if (Type == 1052) 
                {
                    MessageBox.Show("Yey!!!");
                }
                else
                {
                    GamePacketHandler.Handle(Data, GameClient);
                }
            }
        }
Video showing what happens when I run my server :

[Only registered and activated users can see links. Click Here To Register...]

I'm sure the problem isn't the encryption, else I wouldn't have gotten up to this part. Yet, it isn't working. What to do?