Example #1
0
    //Standard constructor.
    public User(List <string> userInfo)
    {
        ID        = ++IDnr;
        userName  = userInfo[0];
        mail      = userInfo[1];
        password  = userInfo[2];
        firstName = userInfo[3];
        lastName  = userInfo[4];

        waitingMessages = new List <string>();
        ServerCrypto sc = new ServerCrypto();

        byte[] byteKey = sc.GenerateAesKey();
        key = System.BitConverter.ToString(byteKey).Replace("-", "");
    }
Example #2
0
    public User(int ID, string userName, string mail, string password, string firstName, string lastName)
    {
        this.ID        = ID;
        this.userName  = userName;
        this.mail      = mail;
        this.password  = password;
        this.firstName = firstName;
        this.lastName  = lastName;

        waitingMessages = new List <string>();
        ServerCrypto sc = new ServerCrypto();

        byte[] byteKey = sc.GenerateAesKey();
        key = System.BitConverter.ToString(byteKey).Replace("-", "");
    }
Example #3
0
        private void HandleEstablishP2P(string incomming)
        {
            string[] messageArray = ParseMessage(incomming);

            string sender   = messageArray[1];
            string receiver = messageArray[2];

            ServerCrypto sc = new ServerCrypto();

            byte[] keyBytes = sc.GenerateAesKey();
            string key      = System.BitConverter.ToString(keyBytes).Replace("-", "");

            int port = server.getNextPort();

            server.SendIncommingP2P(sender, receiver, port, key, (server.FindClient(receiver)).ipAddress);

            Thread.Sleep(500);

            client.writer.WriteOutgoingP2P(receiver, port, key, (server.FindClient(receiver)).ipAddress);
        }