equinoxx
09.08.2005, 23:07
I am trying to create a proxy type system for my server. I have been going over the l2j source code to the best of my ability and I have it down to this much. (No, I dont run an L2J server, I am just using it as a reference)
The following is assuming the client has a valid password and valid protocol version.
1. Client talks with auth server using blowfish
2. Client is connected to world server
3. Client sends protocol version packet
4. Server sends back a 'key' packet, which is 10 bytes. The last 8 bytes are a key.
5. The next packet that the client sends uses this 8 byte key for its encryption
6. Server gets packet, decrypts using the key from step 4.
7. Server changes the key again (part of changing algorithim has to do with the packet size from step 6)
8. Server handles packet (ie, processes attack command)
9. The next packet the server sends to this client is encrypted with the key from step 7.
10. Client gets packet, decrypts using key from step 7.
11. The next packet the client sends is encrypted with the key from step 7.
and so on..
Three things that have me stumped:
1. Are the first two bytes of the packet a size marker? If so, how do I read this size marker? left to right or right to left when converting from base 16 to base 10?
2. I had thought that the first two bytes of each packet were a size marker for that packet. However, the first two bytes of the key packet are 0x00 and 0x01, which equals 1 ... not 10 .... can anyone explain why this is?
3. Each time the server changes the key (send and receive) does it use the length of the payload or does it also count the 2 byte size marker?
The following is assuming the client has a valid password and valid protocol version.
1. Client talks with auth server using blowfish
2. Client is connected to world server
3. Client sends protocol version packet
4. Server sends back a 'key' packet, which is 10 bytes. The last 8 bytes are a key.
5. The next packet that the client sends uses this 8 byte key for its encryption
6. Server gets packet, decrypts using the key from step 4.
7. Server changes the key again (part of changing algorithim has to do with the packet size from step 6)
8. Server handles packet (ie, processes attack command)
9. The next packet the server sends to this client is encrypted with the key from step 7.
10. Client gets packet, decrypts using key from step 7.
11. The next packet the client sends is encrypted with the key from step 7.
and so on..
Three things that have me stumped:
1. Are the first two bytes of the packet a size marker? If so, how do I read this size marker? left to right or right to left when converting from base 16 to base 10?
2. I had thought that the first two bytes of each packet were a size marker for that packet. However, the first two bytes of the key packet are 0x00 and 0x01, which equals 1 ... not 10 .... can anyone explain why this is?
3. Each time the server changes the key (send and receive) does it use the length of the payload or does it also count the 2 byte size marker?