Exemplo n.º 1
0
        string TryAddUser(string request)
        {
            string decrypted = CryptoManager.DecryptRSAFromB64(request);

            if (decrypted.Contains("message"))
            {
                string[]      delim  = { "key=" };
                CryptoManager cm     = new CryptoManager(decrypted.Split(delim, StringSplitOptions.RemoveEmptyEntries)[1]);
                string        userId = Convert.ToBase64String(cm.m_sessionIV);
                //string userName = ServerSpecificStrings.ExtractParamValue("login", decrypted);
                m_connectedUsers.Add(userId, new UserInstance("", cm, new Dictionary <string, int>()));
                //m_usersCrypto.Add(userId, cm);
                //m_usersMessageQueue.Add(userId, new ConcurrentQueue<string>());
                return(userId);
            }
            return("");
        }
Exemplo n.º 2
0
        public ServerManager(string password)
        {
            string serverUser     = "******";
            string serverPassword = "******";
            //"SCSC_SQLite.sqlite"
            SCSC_RSA sc = new SCSC_RSA();

            serverCryptoManager = new CryptoManager();
            serverCryptoManager.SetUser(serverUser, serverPassword);
            //TEST!!
            sqlManager = new SQLManager(serverUser, serverPassword);
            sqlManager.Start("C:\\Work\\Testdb.sqlite");
            sqlManager.CreateTables();
            AddUserToDb("Tester", "Tester");
            //TEST!!
            //m_serverData = new ServerData();
            //m_serverData.Load();
            m_connectedUsers = new Dictionary <string, UserInstance>();
            m_groupChats     = new Dictionary <string, GroupChatInstance>();
            m_listener       = new Listener(8989, this);
            m_listener.StartListen();
        }