Пример #1
0
        public void sigcheck(messC3 m, BigInteger n)
        {
            List <int> pozver = new List <int>();

            for (int i = 0; i < alist.Count(); i++)
            {
                if (alist[i].getQ() == m.getQ())
                {
                    if (rsa.verifySig(m.getQ(), m.getQu(), alist[i].getV(), n) == true)
                    {
                        pozver.Add(i);
                        Console.WriteLine("VALID SIGNATURE FOR {0} !", alist[i].getA());
                    }
                    else
                    {
                        Console.WriteLine("BAD ACCESS ATTEMPT FOR {0} !", alist[i].getA());
                        balist[alist[i].getA()]++;
                        int x = balist[alist[i].getA()];
                        if (x > 2)
                        {
                            Console.WriteLine("TOO MANY BAD ATTEMPTS FOR {0} ! CLIENT BLOCKED !", alist[i].getA());
                        }
                    }
                }
            }
            for (int i = 0; i < pozver.Count; i++)
            {
                alist.RemoveAt(pozver[i]);
            }
        }
Пример #2
0
 private void sendconfirmFake(cserver cs, messC3 m, BigInteger n)
 {
     m = new messC3(m.getQ(), m.getQu() + 1);
     cs.sigcheck(m, n);
 }