예제 #1
0
        private static void HandleChatMessage(SksMessageReceivedEventArgs sksMessageReceivedEventArgs)
        {
            var user = GetUserByIpAndPort(sksMessageReceivedEventArgs.FromIp, sksMessageReceivedEventArgs.FromPort);

            var message = ChatMessage.FromString(sksMessageReceivedEventArgs.Message);

            var secret = user.GetSecretFromProtocol();

            var messageStr = SksAes.DecryptStringFromBytes_Aes(message.EncryptedMessageBytes, secret, message.Iv);

            user.Client.OnChatMessageReceived(user.Client.tcpClient, messageStr);
        }