Exemple #1
0
        public string ReadData()
        {
            try {
                FileStream fs = new FileStream(Application.StartupPath + "/key.txt", FileMode.Open, FileAccess.Read);
                StreamReader sr = new StreamReader(fs);
                sr.BaseStream.Seek(0, SeekOrigin.Begin);
                string str = sr.ReadLine();

                sr.Close();
                fs.Close();
                return str;
            }
            catch {
                YZ y = new YZ();
                y.ShowDialog();
            }
            return "0";
        }
Exemple #2
0
        public void YZ()
        {
            Computer c = new Computer();
            KeysSet k = new KeysSet();
            FileRead f = new FileRead();
            string from_key = f.ReadData();
            string key = c.CpuID;

            if (k.EncryptDES(c.CpuID, "zanglili") != from_key)
            {
                MessageBox.Show("请验证");
                YZ y = new YZ();
                y.ShowDialog();
            }

            //String a1 = k.EncryptDES(key, "zanglili");
            //MessageBox.Show(a1);//加密后的字符串
            //String a2 = k.DecryptDES(a1, "zanglili");
            //MessageBox.Show(a2);//解密后的原样字符串
            // return i;
        }