Example #1
0
        public void Start(SksClientType clientType)
        {
            lock (countLock)
            {
                if (MessageCount != 0)
                {
                    // todo: ERROR - nejake spravy uz boli poslane..
                    return;
                }
            }

            if (clientType == SksClientType.Local)
            {
                var message = new Akep2Message1(NonceA);
                User.SendMessage(message.ToString());
            }

            IncrementMessageCount();
        }
Example #2
0
        private static void HandleAkep2Message1(SksMessageReceivedEventArgs sksMessageReceivedEventArgs)
        {
            var user = GetUserByIpAndPort(sksMessageReceivedEventArgs.FromIp, sksMessageReceivedEventArgs.FromPort);

            var akep2 = InitAkep2(user, SksClientType.Remote);

            if (akep2 == null)
            {
                return;
            }

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

            akep2.NonceA = message.NonceA;
            akep2.NonceB = Utils.GenerateRandom16();

            var newMessage = new Akep2Message2(MyUsername, user.Name, akep2.NonceA, akep2.NonceB, user.Key);

            user.SendMessage(newMessage.ToString());

            akep2.IncrementMessageCount();
        }