예제 #1
0
        private void ActionTime_Tick(object sender, EventArgs e)
        {
            if (CheckForUpdates())
            {
                OpenA = Bridge.OpenA;
                P     = Bridge.P;
                G     = Bridge.G;
                Bridge.UpdatesForBob = false;
                PLbl.Text           += P;
                GLbl.Text           += G;
                OpenALbl.Text       += OpenA;


                FirstStageBob();
                secretKey    = (int)BigInteger.ModPow(OpenA, b, P);
                KeyLbl.Text += secretKey;
                GetKeyHash();
                HashLbl.Text += keyHash;

                Bridge.OpenB           = OpenB;
                Bridge.LogLbl.Text    += "Пользователь 2 отправляет остаток от деления - 'B' в открытом виде,\r\n а также хеш секрета Пользователю 1\r\n";
                Bridge.LogLbl.Text    += $"B={OpenB}\r\n";
                Bridge.LogLbl.Text    += $"ХЕШ={keyHash}\r\n";
                Bridge.LogLbl.Text    += $"{new string('-', 50)}\r\n";
                Bridge.BobsHash        = keyHash;
                Bridge.UpdatesForAlice = true;
                ActionTimer.Stop();
                DecryptBtn.Enabled = true;
                EncryptBtn.Enabled = true;
            }
        }
        private void ActionTimer_Tick(object sender, EventArgs e)
        {
            if (CheckForUpdates() || currentStage == AlicesStages.First)
            {
                switch (currentStage)
                {
                case AlicesStages.First:
                    FirstStageAlice();
                    Bridge.OpenA         = OpenA;
                    Bridge.P             = P;
                    Bridge.G             = G;
                    Bridge.LogLbl.Text  += $"Пользователь 1 отправляет остаток от деления - 'A' в открытом виде,\r\n а также пару чисел 'p' и 'g' Пользователю 2\r\n";
                    Bridge.LogLbl.Text  += $"A={OpenA}\r\np={P}\r\ng={G}\r\n";
                    Bridge.LogLbl.Text  += $"{new string('-', 50)}\r\n";
                    Bridge.UpdatesForBob = true;
                    currentStage         = AlicesStages.Second;
                    break;

                case AlicesStages.Second:
                    SecondStageAlice();
                    KeyLbl.Text           += secretKey;
                    Bridge.UpdatesForAlice = false;
                    if (!KeyHash.Equals(Bridge.BobsHash))
                    {
                        Bridge.LogLbl.Text += "Пользователь 1 отклоняет хеш Пользователя 2\r\n";
                    }
                    else
                    {
                        Bridge.LogLbl.Text += "Пользователь 1 подтверждает хеш Пользователя 2\r\n";
                    }

                    Bridge.LogLbl.Text += $"{new string('-', 50)}\r\n";
                    ActionTimer.Stop();
                    DecryptBtn.Enabled = true;
                    EncryptBtn.Enabled = true;
                    break;

                default:
                    throw new Exception();
                }
            }
        }
예제 #3
0
 void Remove()
 {
     Map.RemoveDropItem(this);
     Timer.Stop();
     Timer = null;
 }
예제 #4
0
 private void ActionTimer_Tick(object sender, EventArgs e)
 {
     ActionTimer.Stop();
     LblAction.Visible = false;
 }
예제 #5
0
 public override void Destroy()
 {
     Session.Connection.StateChanged -= Connection_StateChanged;
     Timer.Stop();
     base.Destroy();
 }
 public void Stop()
 {
     actionTimer.Stop();
 }