Example #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                sbyte[] encr = AESImplementation.encrypt(this.txtPlainText.Text.GetBytes(), this.txtPrivateKey.Text.GetBytes());
                this.txtEncryptText.Text = string.Join(" ", encr);

                sbyte[] decr = AESImplementation.decrypt(encr, this.txtPrivateKey.Text.GetBytes());
                this.txtDecryptText.Text = string.Join(" ", StringHelperClass.NewString(decr));

                this.txtAesLog.Text = string.Join("\n", FileHelper.FileContent);
                FileHelper.FileContent.Clear();
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            try
            {
                string input = "Hello, my name is John Woo";
                string key   = "1a25s8fe5dsg65ad";

                Console.WriteLine("Входен текс: " + input);

                sbyte[] encr = AESImplementation.encrypt(input.GetBytes(), key.GetBytes());
                Console.WriteLine("Криптиран текст със AES: " + StringHelperClass.NewString(encr));

                sbyte[] decr = AESImplementation.decrypt(encr, key.GetBytes());
                Console.WriteLine("Декриптиран текст със AES: " + StringHelperClass.NewString(decr));
                FileHelper.SaveToFile();
            }
            catch (Exception)
            {
                throw;
            }
        }