示例#1
0
        private void Form0_Load(object sender, EventArgs e)
        {
            AES aesCrypt = new AES();
            if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + "FileCrypt_lite.loc"))
            {
                MessageBox.Show("Programm was start in first time. \n Password: 0000");

                File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + "FileCrypt_lite.loc", aesCrypt.EncryptPassword("0000"));
            }
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            AES aesCrypt = new AES();

                string pas = aesCrypt.DecryptPassword(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "FileCrypt_lite.loc"));
                if (pas == textBox1.Text)
                {
                    MF.Show();
                    this.Hide();
                }

                else
                {
                    MessageBox.Show("incorrect password", "The password error");
                    textBox1.Text = null;
                }
        }
示例#3
0
        private void button1_Click(object sender, EventArgs e)
        {
            AES aesCrypt = new AES();
            string password = aesCrypt.DecryptPassword(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "FileCrypt_lite.loc"));
            if (password != textBox1.Text)
            {
                MessageBox.Show("Password wasn't changed. Current password incorrect", "Error");
                textBox1.Text = null;
                textBox2.Text = null;
            }
            else
            {
                string newPas = textBox2.Text;

                File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory+"FileCrypt_lite.loc", aesCrypt.EncryptPassword(newPas));

                MessageBox.Show("Your password successfully changed", "Success!");
            }
        }