diff --git a/Client/Program.cs b/Client/Program.cs index 45ad402..16a7a0a 100644 --- a/Client/Program.cs +++ b/Client/Program.cs @@ -1,6 +1,7 @@ using OSTLibrary.Chats; using OSTLibrary.Classes; using OSTLibrary.Networks; +using OSTLibrary.Securities; using System; using System.Collections.Generic; using System.Diagnostics; @@ -95,7 +96,7 @@ static void Recieve() object pakcetObj = null; try { - pakcetObj = Packet.Deserialize(readBuffer); + pakcetObj = Packet.Deserialize(AES256.Decrypt(readBuffer)); } catch (Exception ex) { @@ -119,7 +120,7 @@ public static void Send(Packet packet) { lock (locker) { - byte[] sendBuffer = packet.Serialize(); + byte[] sendBuffer = AES256.Encrypt(packet.Serialize()); byte[] lengthBuffer = BitConverter.GetBytes(sendBuffer.Length); ns.Write(lengthBuffer, 0, 4); diff --git a/Server/Classes/Client.cs b/Server/Classes/Client.cs index 958ca84..3218c73 100644 --- a/Server/Classes/Client.cs +++ b/Server/Classes/Client.cs @@ -67,7 +67,7 @@ public void Recieve() object pakcetObj = null; try { - pakcetObj = Packet.Deserialize(readBuffer); + pakcetObj = Packet.Deserialize(AES256.Decrypt(readBuffer)); } catch (Exception ex) { @@ -256,7 +256,7 @@ public void Send(Packet packet) { lock (this) { - byte[] sendBuffer = packet.Serialize(); + byte[] sendBuffer = AES256.Encrypt(packet.Serialize()); byte[] lengthBuffer = BitConverter.GetBytes(sendBuffer.Length); ns.Write(lengthBuffer, 0, 4);