Beispiel #1
0
        public void DrupalNetworkTest()
        {
            string uid     = "*****@*****.**";
            string name    = "Pierre St Juste";
            string pcid    = "pdesktop";
            string version = "SVPN_0.3.0";
            string country = "US";

            SocialUtils.CreateCertificate(uid, name, pcid, version, country,
                                          "address1234", "certificates",
                                          "private_key");

            string cert_path = System.IO.Path.Combine("certificates", "lc.cert");

            byte[]     cert_data = SocialUtils.ReadFileBytes(cert_path);
            SocialUser user      = new SocialUser(cert_data);

            /*
             * DrupalNetwork drupal = new DrupalNetwork(user);
             * drupal.Login("pierre", "stjuste");
             *
             * List<string> friends = drupal.GetFriends();
             *
             * foreach(string friend in friends) {
             * Console.WriteLine(friend);
             * List<string> fprs = drupal.GetFingerprints(friend);
             * foreach(string fpr in fprs) {
             *  Console.WriteLine(friend + " " + fpr);
             * }
             * }
             * drupal.StoreFingerprint();
             * drupal.Logout();
             */
        }
Beispiel #2
0
        public void SocialUserTest()
        {
            string uid     = "*****@*****.**";
            string name    = "Pierre St Juste";
            string pcid    = "pdesktop";
            string version = "SVPN_0.3.0";
            string country = "US";

            Certificate cert = SocialUtils.CreateCertificate(uid, name, pcid,
                                                             version, country,
                                                             "address1234",
                                                             "certificates",
                                                             "private_key");

            SocialUser user = new SocialUser(cert.X509.RawData);

            Assert.AreEqual(uid, user.Uid);
            Assert.AreEqual(name, user.Name);
            Assert.AreEqual(pcid, user.PCID);
            Assert.AreEqual(version, user.Version);
            Assert.AreEqual(country, user.Country);
        }
Beispiel #3
0
        public void TestNetworkTest()
        {
            string uid     = "*****@*****.**";
            string name    = "Pierre St Juste";
            string pcid    = "pdesktop";
            string version = "SVPN_0.3.0";
            string country = "US";

            SocialUtils.CreateCertificate(uid, name, pcid, version, country,
                                          "address1234", "certificates",
                                          "private_key");


            string cert_path = System.IO.Path.Combine("certificates", "lc.cert");

            byte[]     cert_data = SocialUtils.ReadFileBytes(cert_path);
            SocialUser user      = new SocialUser(cert_data);

            TestNetwork backend = new TestNetwork(user);

            backend.SayHello();
            backend.GetFingerprints("uid");
        }
Beispiel #4
0
        public static new void Main(string[] args)
        {
            if (args.Length < 3)
            {
                Console.WriteLine("usage: SocialVPN.exe <brunet.config path> " +
                                  "<ipop.config path> <http port>");
                return;
            }

            NodeConfig config = Utils.ReadConfig <NodeConfig>(args[0]);

            if (!System.IO.File.Exists(config.Security.KeyPath))
            {
                Console.Write("Enter Name (First Last): ");
                string name = Console.ReadLine();
                Console.Write("Enter Email Address: ");
                string uid = Console.ReadLine();
                Console.Write("Enter a name for this PC: ");
                string pcid    = Console.ReadLine();
                string version = "SVPN_0.3.0";
                string country = "US";

                config.NodeAddress = (Utils.GenerateAHAddress()).ToString();
                Utils.WriteConfig(args[0], config);
                SocialUtils.CreateCertificate(uid, name, pcid, version, country,
                                              config.NodeAddress,
                                              config.Security.CertificatePath,
                                              config.Security.KeyPath);
            }

            SocialNode node = new SocialNode(args[0], args[1],
                                             config.Security.CertificatePath,
                                             args[2]);

            node.Run();
        }