- Joined
- Jun 29, 2009
- Messages
- 139
- Reaction score
- 12
EDIT: Managed to fix it. My IV's were mixed up. Thanks all!
I'm currently creating a maplestory source from essentially scratch. I say essentially because I am ripping some of the encryption related stuff from Moople because I think it would be a waste of time for me to not.
I can currently decode packets perfectly but am having trouble sending a packet of any time. The only packet the client will accept is the handshake and after that anything will cause it to crash.
This is my packet encoder which is very, very similar to Moople's:
There's nothing to fancy about it. All the encryption classes are completely untouched from the ones from Moople so I am almost sure it has to be something I am doing wrong in the encoder. Any ideas or knowledge on something the client requires before I can send it packets?
I'm currently creating a maplestory source from essentially scratch. I say essentially because I am ripping some of the encryption related stuff from Moople because I think it would be a waste of time for me to not.
I can currently decode packets perfectly but am having trouble sending a packet of any time. The only packet the client will accept is the handshake and after that anything will cause it to crash.
This is my packet encoder which is very, very similar to Moople's:
Code:
@Override
protected void encode(ChannelHandlerContext ctx, byte[] message, ByteBuf out) throws Exception {
MapleClient client = handler.getClient();
if (client != null) {
final MapleAESOFB send_crypto = client.getCryptSend();
final byte[] input = (byte[]) message;
final byte[] unencrypted = new byte[input.length];
System.arraycopy(input, 0, unencrypted, 0, input.length);
final byte[] ret = new byte[unencrypted.length + 4];
final byte[] header = send_crypto
.getPacketHeader(unencrypted.length);
MapleCustomEncryption.encryptData(unencrypted);
send_crypto.crypt(unencrypted);
System.arraycopy(header, 0, ret, 0, 4);
System.arraycopy(unencrypted, 0, ret, 4, unencrypted.length);
out.writeBytes(ret);
} else {
out.writeBytes(message);
}
}
There's nothing to fancy about it. All the encryption classes are completely untouched from the ones from Moople so I am almost sure it has to be something I am doing wrong in the encoder. Any ideas or knowledge on something the client requires before I can send it packets?
Last edited: