public void EncrptedSendLarge <T>(Connection connection, ref T message) where T : IMessage { if (!AESKeys.TryGetValue(connection, out string Key)) { Log.WriteNow("Failed to find AES Key for this connection. Failed to send encrypted message"); return; } AESMessage aesMessage = new AESMessage(message) { ID = message.ID }; aesMessage.Encrypt(Key); byte[] data = MessageUtil.Serialize(ref aesMessage); SendLarge(connection, ref aesMessage, data); }
public void EncrptedSend <T>(ref T message) where T : IMessage { message.TotalParts = 1; message.Part = 0; message.ID = message.ID != 0 ? message.ID : NextID; AESMessage aesMessage = new AESMessage(message) { ID = message.ID }; aesMessage.Encrypt(AESKey); byte[] data = MessageUtil.Serialize(ref aesMessage); BitConverter.GetBytes(data.Length).CopyTo(data, 6); rawClient.Send(data); }
public void EncrptedSend <T>(Connection connection, ref T message) where T : IMessage { if (!AESKeys.TryGetValue(connection, out string Key)) { Log.WriteNow("Failed to find AES Key for this connection. Failed to send encrypted message"); return; } AESMessage aesMessage = new AESMessage(message) { ID = message.ID }; aesMessage.Encrypt(Key); byte[] buffer = MessageUtil.Serialize(ref aesMessage); BitConverter.GetBytes(buffer.Length).CopyTo(buffer, 6); rawServer.Send(connection, buffer); }
public void EncrptedSendLarge <T>(ref T message, byte[] Data = null) where T : IMessage { message.ID = message.ID != 0 ? message.ID : NextID; if (Data == null) { // Message not already serialized Data = MessageUtil.Serialize(ref message); BitConverter.GetBytes(Data.Length).CopyTo(Data, 6); } AESMessage aesMessage = new AESMessage(Data) { ID = message.ID }; aesMessage.Encrypt(AESKey); byte[] data = MessageUtil.Serialize(ref message); SendLarge(ref aesMessage, data); }