public PacketCrypt(byte[] sessionKey) { var encryptHash = s_encryptServerDataHMAC.ComputeHash(sessionKey); var decryptHash = s_decryptClientDataHMAC.ComputeHash(sessionKey); // Used by the client to decrypt packets sent by the server //var decryptServerData = new ARC4(encryptHash); // CLIENT-SIDE // Used by the server to decrypt packets sent by the client decryptClientData = new ARC4(decryptHash); // SERVER-SIDE // Used by the server to encrypt packets sent to the client encryptServerData = new ARC4(encryptHash); // SERVER-SIDE // Used by the client to encrypt packets sent to the server //var encryptClientData = new ARC4(decryptHash); // CLIENT-SIDE // Use the 2 encryption objects to generate a common starting point var syncBuffer = new byte[DropN]; encryptServerData.Process(syncBuffer, 0, syncBuffer.Length); //encryptClientData.Process(syncBuffer, 0, syncBuffer.Length); // Use the 2 decryption objects to generate a common starting point syncBuffer = new byte[DropN]; //decryptServerData.Process(syncBuffer, 0, syncBuffer.Length); decryptClientData.Process(syncBuffer, 0, syncBuffer.Length); }
public PacketCrypt(byte[] sessionKey) { byte[] hash = s_encryptServerDataHMAC.ComputeHash(sessionKey); decryptClientData = new ARC4(s_decryptClientDataHMAC.ComputeHash(sessionKey)); encryptServerData = new ARC4(hash); byte[] buffer1 = new byte[1024]; encryptServerData.Process(buffer1, 0, buffer1.Length); byte[] buffer2 = new byte[1024]; decryptClientData.Process(buffer2, 0, buffer2.Length); }
public PacketCrypt(byte[] sessionKey) { var encryptHash = s_encryptServerDataHMAC.ComputeHash(sessionKey); var decryptHash = s_decryptClientDataHMAC.ComputeHash(sessionKey); // Used by the client to decrypt packets sent by the server //var decryptServerData = new ARC4(encryptHash); // CLIENT-SIDE // Used by the server to decrypt packets sent by the client decryptClientData = new ARC4(decryptHash); // SERVER-SIDE // Used by the server to encrypt packets sent to the client encryptServerData = new ARC4(encryptHash); // SERVER-SIDE // Used by the client to encrypt packets sent to the server //var encryptClientData = new ARC4(decryptHash); // CLIENT-SIDE // Use the 2 encryption objects to generate a common starting point var syncBuffer = new byte[DropN]; encryptServerData.Process(syncBuffer, 0, syncBuffer.Length); //encryptClientData.Process(syncBuffer, 0, syncBuffer.Length); // Use the 2 decryption objects to generate a common starting point syncBuffer = new byte[DropN]; //decryptServerData.Process(syncBuffer, 0, syncBuffer.Length); decryptClientData.Process(syncBuffer, 0, syncBuffer.Length); }
public void Encrypt(byte[] data, int start, int count) { encryptServerData.Process(data, start, count); }
public void Decrypt(byte[] data, int start, int count) { decryptClientData.Process(data, start, count); }