using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
using System.IO;
using System.Xml;
using System.Timers;
using System.Threading;
using Excel = Microsoft.Office.Interop.Excel;

namespace Program
{
    public partial class Form1 : Form
    {
        static int time = 0;
        //pocitadlo pro radky mereni
        public int i_row=2;
        static double cas = 0;
        //az 100 mereni
         string[] metoda = new string[200];
         string[] lena = new string[200];
         public string[] lenb = new string[200];
         public string[] lenm = new string[200];
         public string[] caspole = new string[200];
         public string[] pamet = new string[200];
         bool hotovo = false;

        public Form1()
        {
            InitializeComponent();

        }

        //nasobeni rsa tunel
        private void button1_Click(object sender, EventArgs e)
        {
            SpustRSAtunel();
               }

        public void SpustRSAtunel()
        {
            //Nacte vstupy
            string a = textBox1.Text;
            string b = textBox2.Text;
            string modulus = textBox3.Text;
            //int iterace = Convert.ToInt16(textBox4.Text);

            //Inicializace timeru
            System.Timers.Timer myTimer = new System.Timers.Timer();
            myTimer.Elapsed += new ElapsedEventHandler(DisplayTimeEvent);
            myTimer.Interval = 1;


            //Vytvori instanci klienta (program komunikujici s kartou)
            MyCompany.Client.ClientApp client = new MyCompany.Client.ClientApp();

            //Zapne se timer
            time = 0;
            myTimer.Start();

            //Zobrazi vystup testovaci funkce RSA. Sice vsude predavam parametry RSA, ale u samotneho sifrovani/desifrovani nejsou pouzity
            //if (checkBox1.Checked == true)
            //{
            DateTime startTime = DateTime.Now;
            textBox5.Text = client.FastPower(a, b, modulus);
            DateTime stopTime = DateTime.Now;
            //}
            //else okno.Text = client.FastMulti(a, b, modulus, iterace);

            //Vypne timer
            myTimer.Stop();
            cas = Math.Floor(time * 100.0 / 1);
            okno.Text = textBox5.Text;
            okno.Text = okno.Text + "\r\n" + client.GetInfo();
            //Zobrazi cas
            TimeSpan duration = stopTime - startTime;
            string strsec = duration.TotalMilliseconds.ToString();
            okno.Text = okno.Text + "\r\n" + "Čas: " + strsec + " ms";
            save_data(strsec, client.getA_length().ToString(), client.getB_length().ToString(), client.getM_length().ToString(), "RSA-Kryptovani", client.GetMemory());
   
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
           
        }
       public static void DisplayTimeEvent( object source, ElapsedEventArgs e )
        {
            time++;
        }

       public void InicializaceVstup()
       { 
        //Nacte vstupy
           string a = textBox1.Text;
           string b = textBox2.Text;
           string modulus = textBox3.Text;
           //int iterace = Convert.ToInt16(textBox4.Text);
       }

      
          public void save_data(string Cas, string Lena, string Lenb, string Lenm, string Metoda, string Pamet)
          {
              
              metoda[i_row] = Metoda;
              lena[i_row] = Lena;
              lenb[i_row] = Lenb;
              lenm[i_row] = Lenm;
              caspole[i_row] = Cas;
              pamet[i_row] = Pamet;
                i_row++;
          }

          private void releaseObject(object obj)
          {
              try
              {
                  System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
                  obj = null;
              }
              catch (Exception ex)
              {
                  obj = null;
                  MessageBox.Show("Unable to release the Object " + ex.ToString());
              }
              finally
              {
                  GC.Collect();
              }
          }

          private void button2_Click_1(object sender, EventArgs e)
          {
              if (i_row > 2)
              {
                  ExportToExcel();
              }
              else
              {
                  MessageBox.Show("Nic neni namereno, zapis se neprovede!");
              }
          }

          private void ExportToExcel()
          {
              Excel.Application xlApp;
              Excel.Workbook xlWorkBook;
              Excel.Worksheet worksheet, worksheet2;
              object misValue = System.Reflection.Missing.Value;
              Excel.Range chartRange;

              xlApp = new Excel.ApplicationClass();
              xlWorkBook = xlApp.Workbooks.Add(misValue);
              worksheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
              worksheet2 = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(2);
              //stanov hlavicky 


              // worksheet.Cells.ColumnWidth =
              worksheet.Cells[1, 1] = "Metoda";
              worksheet.Cells[1, 2] = "Delka a [bit]";
              worksheet.Cells[1, 3] = "Delka b [bit]";
              worksheet.Cells[1, 4] = "Delka mod [bit]";
              worksheet.Cells[1, 5] = "Cas vypoctu [ms]";
              worksheet.Cells[1, 6] = "Pamet [b]";

              worksheet2.Cells[1, 1] = "RSA-Kryptování";
              int count1 = 3;
              worksheet2.Cells[2, 2] = "Delka a [bit]";
              worksheet2.Cells[2, 3] = "Delka b [bit]";
              worksheet2.Cells[2, 4] = "Delka mod [bit]";
              worksheet2.Cells[2, 5] = "Cas vypoctu [ms]";
              worksheet2.Cells[2, 6] = "Pamet [b]";

              worksheet2.Cells[1, 8] = "AES-Kryptovani";
              int count2 = 3;
              worksheet2.Cells[2, 9] = "Delka a [bit]";
              worksheet2.Cells[2, 10] = "Delka b [bit]";
              worksheet2.Cells[2, 11] = "Delka mod [bit]";
              worksheet2.Cells[2, 12] = "Cas vypoctu [ms]";
              worksheet2.Cells[2, 13] = "Pamet [b]";

              worksheet2.Cells[1, 14] = "AES-Dekryptovani";
              int count3 = 3;
              worksheet2.Cells[2, 15] = "Delka a [bit]";
              worksheet2.Cells[2, 16] = "Delka b [bit]";
              worksheet2.Cells[2, 17] = "Delka mod [bit]";
              worksheet2.Cells[2, 18] = "Cas vypoctu [ms]";
              worksheet2.Cells[2, 19] = "Pamet [b]";

              worksheet2.Cells[1, 20] = "DES-Kryptovani";
              int count4 = 3;
              worksheet2.Cells[2, 21] = "Delka a [bit]";
              worksheet2.Cells[2, 22] = "Delka b [bit]";
              worksheet2.Cells[2, 23] = "Delka mod [bit]";
              worksheet2.Cells[2, 24] = "Cas vypoctu [ms]";
              worksheet2.Cells[2, 25] = "Pamet [b]";

              worksheet2.Cells[1, 27] = "DES-Dekryptovani";
              int count5 = 3;
              worksheet2.Cells[2, 28] = "Delka a [bit]";
              worksheet2.Cells[2, 29] = "Delka b [bit]";
              worksheet2.Cells[2, 30] = "Delka mod [bit]";
              worksheet2.Cells[2, 31] = "Cas vypoctu [ms]";
              worksheet2.Cells[2, 32] = "Pamet [b]";

              //a napln data
              for (int i = 2; i <= i_row; i++)
              {
                  worksheet.Cells[i, 1] = metoda[i];
                  worksheet.Cells[i, 2] = lena[i];
                  worksheet.Cells[i, 3] = lenb[i];
                  worksheet.Cells[i, 4] = lenm[i];
                  worksheet.Cells[i, 5] = caspole[i];
                  worksheet.Cells[i, 6] = pamet[i];

                  if (metoda[i] == "AES-Kryptovani")
                  {
                      worksheet2.Cells[count2, 9] = lena[i];
                      worksheet2.Cells[count2, 10] = lenb[i];
                      worksheet2.Cells[count2, 11] = lenm[i];
                      worksheet2.Cells[count2, 12] = caspole[i];
                      worksheet2.Cells[count2, 13] = pamet[i];
                      count2++;
                  }
                  else if (metoda[i] == "AES-Dekryptovani")
                  {
                      worksheet2.Cells[count3, 15] = lena[i];
                      worksheet2.Cells[count3, 16] = lenb[i];
                      worksheet2.Cells[count3, 17] = lenm[i];
                      worksheet2.Cells[count3, 18] = caspole[i];
                      worksheet2.Cells[count3, 19] = pamet[i];
                      count3++;
                  }
                  else if (metoda[i] == "DES-Kryptovani")
                  {
                      worksheet2.Cells[count4, 21] = lena[i];
                      worksheet2.Cells[count4, 22] = lenb[i];
                      worksheet2.Cells[count4, 23] = lenm[i];
                      worksheet2.Cells[count4, 24] = caspole[i];
                      worksheet2.Cells[count4, 25] = pamet[i];
                      count4++;
                  }
                  else if (metoda[i] == "DES-Dekryptovani")
                  {
                      worksheet2.Cells[count5, 28] = lena[i];
                      worksheet2.Cells[count5, 29] = lenb[i];
                      worksheet2.Cells[count5, 30] = lenm[i];
                      worksheet2.Cells[count5, 31] = caspole[i];
                      worksheet2.Cells[count5, 32] = pamet[i];
                      count5++;
                  }
                  else
                  {
                      //rsa tunel
                      worksheet2.Cells[count1, 2] = lena[i];
                      worksheet2.Cells[count1, 3] = lenb[i];
                      worksheet2.Cells[count1, 4] = lenm[i];
                      worksheet2.Cells[count1, 5] = caspole[i];
                      worksheet2.Cells[count1, 6] = pamet[i];
                      count1++;
                  }


              }

              //graf 1

              Excel.ChartObjects xlCharts = (Excel.ChartObjects)worksheet.ChartObjects(Type.Missing);
              //left,top,wi,he
              Excel.ChartObject myChart = (Excel.ChartObject)xlCharts.Add(270, 10, 300, 250);
              Excel.Chart chartPage = myChart.Chart;

              chartRange = worksheet.get_Range("A1", "d5");
              chartPage.SetSourceData(chartRange, misValue);
              chartPage.ChartType = Excel.XlChartType.xlColumnClustered;

              //graf 2
              Excel.ChartObjects xlCharts2 = (Excel.ChartObjects)worksheet.ChartObjects(Type.Missing);
              Excel.ChartObject myChart2 = (Excel.ChartObject)xlCharts2.Add(270, 300, 300, 250);
              Excel.Chart chartPage2 = myChart2.Chart;

              chartRange = worksheet.get_Range("d1", "e10");
              chartPage2.SetSourceData(chartRange, misValue);
              chartPage2.ChartType = Excel.XlChartType.xlXYScatterSmooth;
        
              xlWorkBook.SaveAs("ZmerenaDataSmartCard2011.xls", Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
              xlWorkBook.Close(true, misValue, misValue);
              xlApp.Quit();

              releaseObject(xlApp);
              releaseObject(xlWorkBook);
              releaseObject(worksheet);

              MessageBox.Show("File created !");

          }

          private void button4_Click(object sender, EventArgs e)
          {
             //  i_row = 2;
             //string vysledky = "";
             //Random rand = new Random();
             //string prirustek;
             //int pocetmereni= Convert.ToInt32(textBox5.Text);
             //for (int i = 0; i < pocetmereni; i++ )
             //{
             //    //mereni promenne para
             //    prirustek = "28767111116142";             
             //    textBox1.Text = textBox1.Text + prirustek;
             //    textBox2.Text = textBox2.Text + prirustek;

             //    //mereni promenne modulo
             // //  prirustek = "2876786786786786741";
             // //   textBox3.Text = textBox3.Text + prirustek;
             //    SpustSchoolbook();

             //    Thread.Sleep(200);
             //    SpustMonty();
             //    Thread.Sleep(100);
             //    SpustComba();
             //    Thread.Sleep(100);
             //    SpustRSAtunel();
  
             //}

              /*
             string lenaT = "";
             string lenbT = "";
             string casT = "";

             for (int i = 0; i < pocetmereni; i++)
             {

                 lenaT = lenaT + "," + lena[3 * i + 2];
                 lenbT = lenbT + "," + lenb[3 * i + 2];
                 casT = casT + "," + caspole[3 * i + 2];

             }
             vysledky = "SchoolBook - Velikost a,b: " + lenaT + "," + lenbT + " " + " Cas: " + casT + "\r\n";

             lenaT = "";
             lenbT = "";
             casT = "";

              for (int i = 0; i < pocetmereni; i++)
             {

                 lenaT = lenaT + "," + lena[3 * i + 3];
                 lenbT = lenbT + "," + lenb[3 * i + 3];
                 casT = casT + "," + caspole[3 * i + 3];
             }
             vysledky = vysledky + "Comba - Velikost a,b: " + lenaT + "," + lenbT + " " + " Cas: " + casT + "\r\n";

             lenaT = "";
             lenbT = "";
             casT = "";
              for (int i = 0; i < pocetmereni; i++)
             {

                 lenaT = lenaT + "," + lena[3 * i + 4];
                 lenbT = lenbT + "," + lenb[3 * i + 4];
                 casT = casT + "," + caspole[3 * i + 4];
             }
             vysledky = vysledky+ "RSA - Velikost a,b: " + lenaT + "," + lenbT + " " + " Cas: " + casT + "\r\n";
             okno.Text = vysledky;   
               * */

          }

          private void button6_Click(object sender, EventArgs e)
          {
              System.Timers.Timer myTimer = new System.Timers.Timer();
              myTimer.Elapsed += new ElapsedEventHandler(DisplayTimeEvent);
              myTimer.Interval = 1;

              //Vytvori instanci klienta (program komunikujici s kartou)
              MyCompany.Client.ClientApp client = new MyCompany.Client.ClientApp();

              time = 0;
              myTimer.Start();

            //  string output = client.RunProtocol();

              myTimer.Stop();
              cas = Math.Floor(time * 100.0);
            //  okno.Text = output + "\r\n";
              okno.Text = okno.Text + "\r\n" + "Čas: " + cas + " ms";
       
          }

          private void button5_Click(object sender, EventArgs e)
          {

              //Vytvori instanci klienta (program komunikujici s kartou)
          //    MyCompany.Client.ClientApp client = new MyCompany.Client.ClientApp();
          //    client.SetParameters();
          }

          private void button7_Click(object sender, EventArgs e)
          {
              MyCompany.Client.ClientApp client = new MyCompany.Client.ClientApp();
              okno.Text= client.GetRandom();

          }

          private void button8_Click(object sender, EventArgs e)
          {
              //Nacte vstupy
              string a = textBox1.Text;
              string b = textBox2.Text;
              string modulus = textBox3.Text;

              //Vytvori instanci klienta (program komunikujici s kartou)
              //MyCompany.Client.ClientApp client = new MyCompany.Client.ClientApp();
              //okno.Text = client.Test(a,b,modulus);
              
          }

          private void button9_Click(object sender, EventArgs e)
          {
              //Kryptovani DES
              SpustDESKryptovani();
          }
          private void SpustDESKryptovani()
          {
              //Kryptovani AES
              string a = textBox1.Text;
              string b = textBox2.Text;
              string modulus = textBox3.Text;

              System.Timers.Timer myTimer = new System.Timers.Timer();
              myTimer.Elapsed += new ElapsedEventHandler(DisplayTimeEvent);
              myTimer.Interval = 1;


              //Vytvori instanci klienta (program komunikujici s kartou)
              MyCompany.Client.ClientApp client = new MyCompany.Client.ClientApp();

              //Zapne se timer
              time = 0;
              myTimer.Start();
              DateTime startTime = DateTime.Now;
              textBox5.Text = client.Enc_DES(a, b, modulus);
              DateTime stopTime = DateTime.Now;

              myTimer.Stop();
              cas = Math.Floor(time * 1.0);
              okno.Text = textBox5.Text;
              okno.Text = okno.Text + "\r\n" + client.GetInfo();
              //Zobrazi cas
              TimeSpan duration = stopTime - startTime;
              string strsec = duration.TotalMilliseconds.ToString();
              okno.Text = okno.Text + "\r\n" + "Čas: " + strsec + " ms";
              save_data(strsec, client.getA_length().ToString(), client.getB_length().ToString(), client.getM_length().ToString(), "DES-Kryptovani", client.GetMemory());
          }

          private void button13_Click(object sender, EventArgs e)
          {
              //Dekryptovani DES
              SpustDESDekryptovani();
          }
          private void SpustDESDekryptovani()
          {
              //Kryptovani AES
              string a = textBox5.Text;
              string b = textBox2.Text;
              string modulus = textBox3.Text;

              System.Timers.Timer myTimer = new System.Timers.Timer();
              myTimer.Elapsed += new ElapsedEventHandler(DisplayTimeEvent);
              myTimer.Interval = 1;


              //Vytvori instanci klienta (program komunikujici s kartou)
              MyCompany.Client.ClientApp client = new MyCompany.Client.ClientApp();

              //Zapne se timer
              time = 0;
              myTimer.Start();
              DateTime startTime = DateTime.Now;
              textBox1.Text = client.Dec_DES(a, b, modulus);

              DateTime stopTime = DateTime.Now;
              myTimer.Stop();
              cas = Math.Floor(time * 1.0);
              okno.Text = textBox1.Text;
              okno.Text = okno.Text + "\r\n" + client.GetInfo();
              //Zobrazi cas
              TimeSpan duration = stopTime - startTime;
              string strsec = duration.TotalMilliseconds.ToString();
              okno.Text = okno.Text + "\r\n" + "Čas: " + strsec + " ms";
              save_data(strsec, client.getA_length().ToString(), client.getB_length().ToString(), client.getM_length().ToString(), "DES-Dekryptovani", client.GetMemory());
          }
          private void button11_Click(object sender, EventArgs e)
          {
              SpustAESKryptovani();
          }
          private void SpustAESKryptovani()
          {
              //Kryptovani AES
              string a = textBox1.Text;
              string b = textBox2.Text;
              string modulus = textBox3.Text;

              System.Timers.Timer myTimer = new System.Timers.Timer();
              myTimer.Elapsed += new ElapsedEventHandler(DisplayTimeEvent);
              myTimer.Interval = 1;


              //Vytvori instanci klienta (program komunikujici s kartou)
              MyCompany.Client.ClientApp client = new MyCompany.Client.ClientApp();

              //Zapne se timer
              time = 0;
              myTimer.Start();
              DateTime startTime = DateTime.Now;
              textBox5.Text = client.Enc_AES(a, b, modulus);

              DateTime stopTime = DateTime.Now;
              myTimer.Stop();
              cas = Math.Floor(time * 1.0);
              okno.Text = textBox5.Text;
              okno.Text = okno.Text + "\r\n" + client.GetInfo();
              //Zobrazi cas
              TimeSpan duration = stopTime - startTime;
              string strsec = duration.TotalMilliseconds.ToString();
              okno.Text = okno.Text + "\r\n" + "Čas: " + strsec + " ms";
              save_data(strsec, client.getA_length().ToString(), client.getB_length().ToString(), client.getM_length().ToString(), "AES-Kryptovani", client.GetMemory());
          }
          private void button12_Click(object sender, EventArgs e)
          {
              //Dekryptovani AES
              SpustAESDekryptovani();
          }

        private void SpustAESDekryptovani()
        {
            //Dekryptovani AES
              string a = textBox5.Text;
              string b = textBox2.Text;
              string modulus = textBox3.Text;

              System.Timers.Timer myTimer = new System.Timers.Timer();
              myTimer.Elapsed += new ElapsedEventHandler(DisplayTimeEvent);
              myTimer.Interval = 1;
              DateTime startTime = DateTime.Now;

              //Vytvori instanci klienta (program komunikujici s kartou)
              MyCompany.Client.ClientApp client = new MyCompany.Client.ClientApp();

              //Zapne se timer
              time = 0;
              myTimer.Start();

              textBox1.Text =  client.Dec_AES(a, b, modulus);
              DateTime stopTime = DateTime.Now;
              myTimer.Stop();
              cas = Math.Floor(time * 1.0);
              okno.Text = textBox1.Text;
              okno.Text = okno.Text + "\r\n" + client.GetInfo();
              //Zobrazi cas
              
              TimeSpan duration = stopTime - startTime;
              string strsec = duration.TotalMilliseconds.ToString();
              okno.Text = okno.Text + "\r\n" + "Čas: " + strsec + " ms";

              save_data(strsec, client.getA_length().ToString(), client.getB_length().ToString(), client.getM_length().ToString(), "AES-Dekryptovani", client.GetMemory());
        }

          private void radioButton5_CheckedChanged(object sender, EventArgs e)
          {

          }

          private void button3_Click_1(object sender, EventArgs e)
          {
              // DES novy klic
              MyCompany.Client.ClientApp client = new MyCompany.Client.ClientApp();
              textBox2.Text = client.Key_DES(64);
          }
          


          private void button14_Click(object sender, EventArgs e)
          {
              int pocetmereni = Convert.ToInt32(textBox4.Text);
              for (int i = 0; i < pocetmereni; i++)
              {
                  SpustRSAtunel();
                  //Thread.Sleep(200);
                  //SpustDekryptovaniRSAtunel();
                  Thread.Sleep(100);
              }
              for (int i = 0; i < pocetmereni; i++)
              {
                  SpustAESKryptovani();
                  Thread.Sleep(100);
              }
              for (int i = 0; i < pocetmereni; i++)
              {
                  SpustAESDekryptovani();
                  Thread.Sleep(100);
              }
              for (int i = 0; i < pocetmereni; i++)
              {
                  SpustDESKryptovani();
                  Thread.Sleep(100);
              }
              for (int i = 0; i < pocetmereni; i++)
              {
                  SpustDESDekryptovani();
                  Thread.Sleep(100);
              }
              MessageBox.Show("Měření dokončeno.");
          }

          private void button10_Click(object sender, EventArgs e)
          {
              SpustDekryptovaniRSAtunel();
          }

          public void SpustDekryptovaniRSAtunel()
          {
              //Nacte vstupy
              string a = textBox5.Text;
              string b = textBox2.Text;
              string modulus = textBox3.Text;
              //int iterace = Convert.ToInt16(textBox4.Text);

              //Inicializace timeru
              System.Timers.Timer myTimer = new System.Timers.Timer();
              myTimer.Elapsed += new ElapsedEventHandler(DisplayTimeEvent);
              myTimer.Interval = 1;


              //Vytvori instanci klienta (program komunikujici s kartou)
              MyCompany.Client.ClientApp client = new MyCompany.Client.ClientApp();

              //Zapne se timer
              time = 0;
              myTimer.Start();
              DateTime startTime = DateTime.Now;

              //Zobrazi vystup testovaci funkce RSA. Sice vsude predavam parametry RSA, ale u samotneho sifrovani/desifrovani nejsou pouzity
              //if (checkBox1.Checked == true)
              //{
              textBox1.Text = client.FastDePower(a, b, modulus);
              //}
              //else okno.Text = client.FastMulti(a, b, modulus, iterace);

              //Vypne timer
              myTimer.Stop();
              DateTime stopTime = DateTime.Now;
              cas = Math.Floor(time * 1.0);
              okno.Text = textBox1.Text;
              okno.Text = okno.Text + "\r\n" + client.GetInfo();
              TimeSpan duration = stopTime - startTime;
              string strsec = duration.TotalMilliseconds.ToString();
              //Zobrazi cas
              okno.Text = okno.Text + "\r\n" + "Čas: " + cas + " ms";
              save_data(strsec, client.getA_length().ToString(), client.getB_length().ToString(), client.getM_length().ToString(), "RSA-Kryptovani", client.GetMemory());

          }

          private void button8_Click_1(object sender, EventArgs e)
          {
              // Novy exponent
              Random Rand = new Random();
              string novyexp = "";
              int End = 308;
              if (radioButton1.Checked == true)
              {
                  End = 616;
              }
              if (radioButton8.Checked == true)
              {
                  End = 154;
              }
              if (radioButton9.Checked == true)
              {
                  End = 77;
              }
              for (int i = 0; i < End; i++)
              {
                  novyexp = novyexp + Rand.Next(0, 9).ToString();
              }
              textBox2.Text = novyexp;
          }

          private void button7_Click_1(object sender, EventArgs e)
          {
              // Novy modulus
              Random Rand = new Random();
              string novymod = "";
              for (int i = 0; i < 608; i++)
              {
                  novymod = novymod + Rand.Next(0, 9).ToString();
              }
              textBox3.Text = novymod;
          }

          private void button6_Click_1(object sender, EventArgs e)
          {
              // AES novy vstupni klic
              int keysize = 128;
              if (radioButton5.Checked == true)
              {
                  keysize = 256;
              }
              MyCompany.Client.ClientApp client = new MyCompany.Client.ClientApp();
              textBox2.Text = client.Key_AES(keysize);
          }

          private void button4_Click_1(object sender, EventArgs e)
          {
              // DES novy vstupni vektor
              MyCompany.Client.ClientApp client = new MyCompany.Client.ClientApp();
              textBox3.Text = client.IV_DES();
          }

          private void button5_Click_1(object sender, EventArgs e)
          {
              // AES novy vstupni vektor
              MyCompany.Client.ClientApp client = new MyCompany.Client.ClientApp();
              textBox3.Text = client.IV_AES();
          }



    }
}
