Beispiel #1
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CipherMode mode = CipherMode.CFB;
                switch (comboBox1.SelectedItem.ToString())
                {
                case "System.Windows.Controls.ComboBoxItem: CBC":
                    mode = CipherMode.CBC;
                    break;

                case "System.Windows.Controls.ComboBoxItem: CFB":
                    mode = CipherMode.CFB;
                    break;

                case "System.Windows.Controls.ComboBoxItem: ECB":
                    mode = CipherMode.ECB;
                    break;
                }
                switch (comboBox.SelectedItem.ToString())
                {
                case "System.Windows.Controls.ComboBoxItem: Aes":
                    Aes.Encrypt_AES(openFileDialog1, passwordBox.Password, mode);
                    break;

                case "System.Windows.Controls.ComboBoxItem: Rijndael":
                    Rijndael.Encrypt_Rijndael(openFileDialog1, passwordBox.Password, mode);
                    break;

                case "System.Windows.Controls.ComboBoxItem: RC2":
                    RC2.Encrypt_RC2(openFileDialog1, passwordBox.Password, mode);
                    break;

                case "System.Windows.Controls.ComboBoxItem: HOST 28147-89":
                    host28147_89.Encrypt_AES(openFileDialog1, passwordBox.Password, mode);
                    break;
                }
            }
            catch (Exception en) { MessageBox.Show("Select all options", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }
Beispiel #2
0
        //////////////////////////Folder Lock//////////////////////////////

        private void button6_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            string[] files = Directory.GetFiles(folderBrowserDialog.SelectedPath, "*.*", SearchOption.AllDirectories);

            CipherMode mode = CipherMode.CFB;

            switch (comboBox3.SelectedItem.ToString())
            {
            case "System.Windows.Controls.ComboBoxItem: CBC":
                mode = CipherMode.CBC;
                break;

            case "System.Windows.Controls.ComboBoxItem: CFB":
                mode = CipherMode.CFB;
                break;

            case "System.Windows.Controls.ComboBoxItem: ECB":
                mode = CipherMode.ECB;
                break;
            }
            switch (comboBox2.SelectedItem.ToString())
            {
            case "System.Windows.Controls.ComboBoxItem: Aes":
                for (int i = 0; i < files.Length; i++)
                {
                    try
                    {
                        open.FileName = files[i];
                        Aes.Encrypt_AES(open, passwordBox_Copy.Password, mode);
                    }
                    catch (Exception ex) { MessageBox.Show(ex.Message); }
                }

                break;

            case "System.Windows.Controls.ComboBoxItem: Rijndael":
                for (int i = 0; i < files.Length; i++)
                {
                    try
                    {
                        open.FileName = files[i];
                        Rijndael.Encrypt_Rijndael(open, passwordBox_Copy.Password, mode);
                    }
                    catch (Exception ex) { MessageBox.Show(ex.Message); }
                }
                break;

            case "System.Windows.Controls.ComboBoxItem: RC2":
                for (int i = 0; i < files.Length; i++)
                {
                    try
                    {
                        open.FileName = files[i];
                        RC2.Encrypt_RC2(open, passwordBox_Copy.Password, mode);
                    }
                    catch (Exception ex) { MessageBox.Show(ex.Message); }
                }
                break;
            }
        }