Esempio n. 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();
             */
        }
Esempio n. 2
0
        /**
         * Constructor.
         * @param brunetConfig configuration file for Brunet P2P library.
         * @param ipopConfig configuration file for IP over P2P app.
         */
        public SocialNode(string brunetConfig, string ipopConfig,
                          string certDir, string port) :
            base(brunetConfig, ipopConfig)
        {
            _friends  = new Dictionary <string, SocialUser>();
            _cert_dir = certDir;
            string cert_path = Path.Combine(certDir, CERTFILENAME);

            _local_cert     = new Certificate(SocialUtils.ReadFileBytes(cert_path));
            _local_user     = new SocialUser(_local_cert);
            _local_cert_b64 = Convert.ToBase64String(_local_cert.X509.RawData);
            _bso.CertificateHandler.AddCACertificate(_local_cert.X509);
            _bso.CertificateHandler.AddSignedCertificate(_local_cert.X509);
            _snp = new SocialNetworkProvider(this.Dht, _local_user);
            _srh = new SocialRpcHandler(_node, _local_user, _friends);
            _scm = new SocialConnectionManager(this, _snp, _snp, port, _friends,
                                               _srh);
        }
Esempio n. 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");
        }