Exemplo n.º 1
0
        public void receive_key_public(string[] mess)
        {
            SHA256 sha256 = SHA256Managed.Create();

            dh.Tao_key_chung(Convert.ToInt32(mess[1]));
            key         = sha256.ComputeHash(Encoding.ASCII.GetBytes(Convert.ToString(dh.Key_Chung)));
            txtkey.Text = Convert.ToBase64String(key);
            session     = true;
        }
Exemplo n.º 2
0
        public void send_key_public(string[] mess)
        {
            SHA256 sha256 = SHA256Managed.Create();

            p  = Convert.ToInt32(mess[1]);
            g  = Convert.ToInt32(mess[2]);
            dh = new Diffie_hellman(p, g);
            dh.Tao_key_chung(Convert.ToInt32(mess[3]));
            key = sha256.ComputeHash(Encoding.ASCII.GetBytes(Convert.ToString(dh.Key_Chung)));
            senddata(Convert.ToString("Receive_Key" + ";" + dh.Publickey));
            txtkey.Text = Convert.ToBase64String(key);
            session     = true;
        }