Пример #1
0
        static void Main(string[] args)
        {
            cserver[] sl = new cserver[3];
            for (int i = 0; i < sl.Length; i++)
                sl[i] = new cserver();

            client c1 = new client("StravoS");  c1.genParam(sl);
            client c2 = new client("Ana");      c2.genParam(sl);
            client c3 = new client("Gigel");    c3.genParam(sl);

            c1.enrollment("sv11");
            c2.enrollment("asd");
            c3.enrollment("a22");

            c1.retreive("sv11",true);
            c2.retreive("asd",true);
            c2.retreive("a645",false);
            c3.retreive("a22",false);
            c3.retreive("a22",false);
            c3.retreive("a22",false);
            c3.retreive("a22", true);

            for (int i = 0; i < sl.Length; i++)
                Console.WriteLine(sl[i]);

            Console.WriteLine("\nSession completed !");
            Console.Read();
        }
Пример #2
0
        static void Main(string[] args)
        {
            cserver[] sl = new cserver[3];
            for (int i = 0; i < sl.Length; i++)
            {
                sl[i] = new cserver();
            }

            client c1 = new client("StravoS");  c1.genParam(sl);
            client c2 = new client("Ana");      c2.genParam(sl);
            client c3 = new client("Gigel");    c3.genParam(sl);

            c1.enrollment("sv11");
            c2.enrollment("asd");
            c3.enrollment("a22");

            c1.retreive("sv11", true);
            c2.retreive("asd", true);
            c2.retreive("a645", false);
            c3.retreive("a22", false);
            c3.retreive("a22", false);
            c3.retreive("a22", false);
            c3.retreive("a22", true);

            for (int i = 0; i < sl.Length; i++)
            {
                Console.WriteLine(sl[i]);
            }

            Console.WriteLine("\nSession completed !");
            Console.Read();
        }
Пример #3
0
        /*        private bool isPrime(BigInteger x)
                {
                    if (x % 2 == 0)
                        return false;
                    x = BigInteger.Abs(x);
                    BigInteger sq=new BigInteger(Math.Exp(BigInteger.Log(x)/2));
                    for (BigInteger i = 3; i < sq; i = i + 2)
                    {
                        if (x % i == 0)
                            return false;
                    }
                    return true;
                }
                private BigInteger genPrime(int nb)
                {

                    BigInteger pp = new BigInteger();

                    do
                    {
                        var rng = new RNGCryptoServiceProvider();
                        byte[] bytes = new byte[nb / 8];
                        rng.GetBytes(bytes);
                        pp = new BigInteger(bytes);
                    }
                    while (!isPrime(pp));

                    return pp;
                }*/
        public void genParam(cserver[] cs)
        {
            gennr(false);
            setservers(cs);
        }
Пример #4
0
 private messS1 sendrequest(cserver cs, messC2 m)
 {
     cs.accept(m,p);
     return cs.reply();
 }
Пример #5
0
 private void setservers(cserver[] cs)
 {
     slist = cs;
 }
Пример #6
0
 private void sendconfirmFake(cserver cs, messC3 m, BigInteger n)
 {
     m = new messC3(m.getQ(), m.getQu() + 1);
     cs.sigcheck(m, n);
 }
Пример #7
0
 private void sendenroll(cserver cs, messC1 m)
 {
     cs.enroll(m);
 }
Пример #8
0
 private void sendconfirm(cserver cs, messC3 m,BigInteger n)
 {
     cs.sigcheck(m,n);
 }
Пример #9
0
 private void sendconfirmFake(cserver cs, messC3 m, BigInteger n)
 {
     m = new messC3(m.getQ(), m.getQu() + 1);
     cs.sigcheck(m, n);
 }
Пример #10
0
 private void sendconfirm(cserver cs, messC3 m, BigInteger n)
 {
     cs.sigcheck(m, n);
 }
Пример #11
0
 private messS1 sendrequest(cserver cs, messC2 m)
 {
     cs.accept(m, p);
     return(cs.reply());
 }
Пример #12
0
 private void sendenroll(cserver cs, messC1 m)
 {
     cs.enroll(m);
 }