示例#1
0
        public void enrollment(String pass)
        {
            BigInteger e, d, n;

            genRSAKeys(out e, out d, out n);

            BigInteger gp = gengp(pass);

            int cnt = slist.Length;

            BigInteger[] yrand  = genyi(cnt, gp);
            BigInteger[] shares = genshares(gp, yrand);
            BigInteger   Km     = genmaster(shares);

            BigInteger proofPKm = genproof(gp, Km);

            byte[] Uk = cryptU(d, Km);

            for (int i = 0; i < cnt; i++)
            {
                messC1 m = new messC1(name, yrand[i], e, Uk, proofPKm);
                sendenroll(slist[i], m);
            }
            enrolled = true;
            Console.WriteLine("\n{0}: Enrollemnt Succesful !", name);
        }
示例#2
0
        public void accept(messC2 m, BigInteger p)
        {
            String c = m.getA();

            if (balist[c] > 2)
            {
                Console.WriteLine("\nCLIENT {0} BLOCKED !", c);
                rep = null;
            }
            else
            {
                messC1 c1 = clist[c];
                messL  l  = new messL(c, m.getQ(), c1.getV(), DateTime.Now);
                alist.Add(l);

                BigInteger R = m.getQ().modPow(c1.getyi(), p);
                //Console.WriteLine("\nRi: " + R);
                rep = new messS1(R, c1.getUk(), c1.getproof());
            }
        }
示例#3
0
 private void sendenroll(cserver cs, messC1 m)
 {
     cs.enroll(m);
 }
示例#4
0
 public void enroll(messC1 m)
 {
     clist.Add(m.getA(), m);
     balist.Add(m.getA(), 0);
 }