예제 #1
0
        private void CheckKey()
        {
            if (_filePath != "" && key_textBox.Text != "Key" && key_textBox.Text != "")
            {
                _key = key_textBox.Text;
                _secureFile.UpdateKey(_key);

                if (mode_comboBox.SelectedIndex == 1)
                {
                    if (_secureFile.ValidateKeyForDecryption(_filePath))
                    {
                        keyStatus_label.Text      = "Key is Correct!";
                        keyStatus_label.ForeColor = Color.Green;
                        start_button.Enabled      = true;
                    }
                    else
                    {
                        keyStatus_label.Text      = "Key is Incorrect!";
                        keyStatus_label.ForeColor = Color.Red;
                        start_button.Enabled      = false;
                    }
                }
                else if (mode_comboBox.SelectedIndex == 0)
                {
                    keyStatus_label.Text      = "Key is Viable!";
                    keyStatus_label.ForeColor = Color.Green;

                    start_button.Enabled = true;
                }
            }
            else if (key_textBox.Text == "Key" || key_textBox.Text == "")
            {
                keyStatus_label.Text      = "Key is Missing!";
                keyStatus_label.ForeColor = Color.Red;
                start_button.Enabled      = false;
            }
        }