Esempio n. 1
0
        private void ProcessServerMessages(AsynchronousSocket socket)
        {
            // Get the encrypted byte array from the client
            byte[] encryptedMessage = SRP6.SubArray(
                socket.ReceiveBuffer, 0,
                socket.ReceiveBufferLength);

            // Start file receive
            if (isReceivingUpdate && !socket.IsReceivingFile)
            {
                receiveStream = new MemoryStream();
                socket.BeginFileReceive(receiveStream);
            }

            // FileReceive In-Progress
            if (socket.IsReceivingFile)
            {
                ProcessFileReceive(socket, encryptedMessage);
                return;
            }

            // Get the decrypted message
            byte[] message = srpClient.Decrypt(encryptedMessage);
            ProcessDecryptedServerMessages(socket, message);
        }
Esempio n. 2
0
        private void ProcessClientMessage(AsynchronousSocket socket)
        {
            // Get the encrypted byte array from the client
            byte[] encryptedMessage = SRP6.SubArray(
                socket.ReceiveBuffer, 0,
                socket.ReceiveBufferLength);
            OnDebug("Received encrypted client message, length = " +
                    socket.ReceiveBufferLength);

            // Start file receive
            if (isReceivingCrashReport && !socket.IsReceivingFile)
            {
                OnDebug("Starting receive of crash report");
                receiveStream = new MemoryStream();
                socket.BeginFileReceive(receiveStream);
            }

            // FileReceive In-Progress
            if (socket.IsReceivingFile)
            {
                ProcessFileReceive(socket, encryptedMessage);
                return;
            }

            // Get the decrypted message
            byte[] message = srpServer.Decrypt(encryptedMessage);
            ProcessDecryptedClientMessages(socket, message);
        }