Exemple #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();
        }
Exemple #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();
        }
Exemple #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);
        }
Exemple #4
0
 private messS1 sendrequest(cserver cs, messC2 m)
 {
     cs.accept(m,p);
     return cs.reply();
 }
Exemple #5
0
 private void setservers(cserver[] cs)
 {
     slist = cs;
 }
Exemple #6
0
 private void sendconfirmFake(cserver cs, messC3 m, BigInteger n)
 {
     m = new messC3(m.getQ(), m.getQu() + 1);
     cs.sigcheck(m, n);
 }
Exemple #7
0
 private void sendenroll(cserver cs, messC1 m)
 {
     cs.enroll(m);
 }
Exemple #8
0
 private void sendconfirm(cserver cs, messC3 m,BigInteger n)
 {
     cs.sigcheck(m,n);
 }
Exemple #9
0
 private void sendconfirmFake(cserver cs, messC3 m, BigInteger n)
 {
     m = new messC3(m.getQ(), m.getQu() + 1);
     cs.sigcheck(m, n);
 }
Exemple #10
0
 private void sendconfirm(cserver cs, messC3 m, BigInteger n)
 {
     cs.sigcheck(m, n);
 }
Exemple #11
0
 private messS1 sendrequest(cserver cs, messC2 m)
 {
     cs.accept(m, p);
     return(cs.reply());
 }
Exemple #12
0
 private void sendenroll(cserver cs, messC1 m)
 {
     cs.enroll(m);
 }