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(); }
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(); }
/* 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); }
private messS1 sendrequest(cserver cs, messC2 m) { cs.accept(m,p); return cs.reply(); }
private void setservers(cserver[] cs) { slist = cs; }
private void sendconfirmFake(cserver cs, messC3 m, BigInteger n) { m = new messC3(m.getQ(), m.getQu() + 1); cs.sigcheck(m, n); }
private void sendenroll(cserver cs, messC1 m) { cs.enroll(m); }
private void sendconfirm(cserver cs, messC3 m,BigInteger n) { cs.sigcheck(m,n); }
private void sendconfirm(cserver cs, messC3 m, BigInteger n) { cs.sigcheck(m, n); }
private messS1 sendrequest(cserver cs, messC2 m) { cs.accept(m, p); return(cs.reply()); }