protected PeerSecOverlord CreateInvalidSO(string name, int level) { if (rsa == null) { rsa = new RSACryptoServiceProvider(); byte[] blob = rsa.ExportCspBlob(false); RSACryptoServiceProvider rsa_pub = new RSACryptoServiceProvider(); rsa_pub.ImportCspBlob(blob); CertificateMaker cm = new CertificateMaker("United States", "UFL", "ACIS", "David Wolinsky", "*****@*****.**", rsa_pub, "brunet:node:abcdefghijklmnopqrs"); Certificate cert = cm.Sign(cm, rsa); x509 = cert.X509; } CertificateHandler ch = new CertificateHandler(); if (level == 2 || level == 0) { ch.AddCACertificate(x509); } if (level == 3 || level == 0) { ch.AddSignedCertificate(x509); } Random rand = new Random(); ReqrepManager rrm = new ReqrepManager("so" + name + rand.Next()); _timeout += rrm.TimeoutChecker; PeerSecOverlord so = new PeerSecOverlord(rsa_safe, ch, rrm); so.AnnounceSA += AnnounceSA; RoutingDataHandler rdh = new RoutingDataHandler(); rrm.Subscribe(so, null); so.Subscribe(rdh, null); rdh.Subscribe(rrm, null); return(so); }
protected SecurityOverlord CreateInvalidSO(string name, int level) { if(rsa == null) { rsa = new RSACryptoServiceProvider(); byte[] blob = rsa.ExportCspBlob(false); RSACryptoServiceProvider rsa_pub = new RSACryptoServiceProvider(); rsa_pub.ImportCspBlob(blob); CertificateMaker cm = new CertificateMaker("United States", "UFL", "ACIS", "David Wolinsky", "*****@*****.**", rsa_pub, "brunet:node:abcdefghijklmnopqrs"); Certificate cert = cm.Sign(cm, rsa); x509 = cert.X509; } CertificateHandler ch = new CertificateHandler(); if(level == 2 || level == 0) { ch.AddCACertificate(x509); } if(level == 3 || level == 0) { ch.AddSignedCertificate(x509); } ReqrepManager rrm = new ReqrepManager("so" + name); _timeout += rrm.TimeoutChecker; SecurityOverlord so = new SecurityOverlord(rsa_safe, rrm, ch); so.AnnounceSA += AnnounceSA; RoutingDataHandler rdh = new RoutingDataHandler(); rrm.Subscribe(so, null); so.Subscribe(rdh, null); rdh.Subscribe(rrm, null); return so; }