Пример #1
0
        private void text_mima_Enter(object sender, System.EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.InitialDirectory = XMLDealTool.getKeyPath();
            dlg.Filter           = "密钥文件|*.png";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                key = KeyConvert.GetKeyByImage(dlg.FileName);

                string url    = XMLDealTool.getUrlPath() + "cloudkey/getpass.php";
                string data   = "username="******"&password="******"&key=" + key + "&num=" + this.record.num;
                string result = HttpGet.HttpGet_test(url, data);
                if (result.Equals("error"))
                {
                    MessageBox.Show("无效密钥!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                text_mima.Text = dlg.FileName;
            }
        }
Пример #2
0
        private void Btn_jiexi_Click(object sender, EventArgs e)
        {
            int            num  = selectedRecord.num;
            string         mima = "";
            OpenFileDialog dlg  = new OpenFileDialog();

            dlg.InitialDirectory = XMLDealTool.getKeyPath();
            dlg.Filter           = "密钥文件|*.png";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                string key = KeyConvert.GetKeyByImage(dlg.FileName);


                string url    = XMLDealTool.getUrlPath() + "cloudkey/getpass.php";
                string data   = "username="******"&password="******"&key=" + key + "&num=" + num;
                string result = HttpGet.HttpGet_test(url, data);
                if (result.IndexOf("error") != -1)
                {
                    MessageBox.Show("解析失败,请检查密钥图片是否正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                //MessageBox.Show("您的账号密码是:" + result, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                result = Encrypt.Base64ToString(result);
                mima   = Encrypt.AESDecrypt(result, key);
                if (mima.IndexOf("error") != -1)
                {
                    MessageBox.Show("解析失败,请检查密钥图片是否正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                return;
            }
            MessageBox.Show("您的账号密码是:" + mima, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }