#Never mind, solved.
To those who replied, thanks.
To those who replied, thanks.
I'm working with patch 5517 and I was following your guide.Quote:
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.
Quote:
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...]
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);
}
}
}