How To Code An AES Text Encryption Program Application In C# NET

Subscribers:
38,900
Published on ● Video Link: https://www.youtube.com/watch?v=u4jtWWH1X_U



Counter-Strike: Source
Category:
Tutorial
Duration: 18:42
3,777 views
49


Hope you all enjoy the video. Sorry it is a little chopped as showing me typing all of the code would have resulted in the video being an hour long. Here is the source code:

Encryptor class:

using Microsoft.SqlServer.Server;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace EncForTurorial
{
class Encryptor
{
public static string IV = "1a1a1a1a1a1a1a1a";
public static string Key = "1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a13";

public static string Encrypt(string decrypted)
{
byte[] textBytes = ASCIIEncoding.ASCII.GetBytes(decrypted);
AesCryptoServiceProvider endec = new AesCryptoServiceProvider(); ;
endec.BlockSize = 128;
endec.KeySize = 256;
endec.IV = ASCIIEncoding.ASCII.GetBytes(IV);
endec.Key = ASCIIEncoding.ASCII.GetBytes(Key);
endec.Padding = PaddingMode.PKCS7;
endec.Mode = CipherMode.CBC;
ICryptoTransform icrypt = endec.CreateEncryptor(endec.Key, endec.IV);
byte[] enc = icrypt.TransformFinalBlock(textBytes, 0, textBytes.Length);
icrypt.Dispose();
return Convert.ToBase64String(enc);
}

public static string Decrypted(string encrypted)
{
var check = Form1.verify;
string password = Form1.password;

if (check == password)
{
byte[] textbytes = Convert.FromBase64String(encrypted);
AesCryptoServiceProvider endec = new AesCryptoServiceProvider();
endec.BlockSize = 128;
endec.KeySize = 256;
endec.IV = ASCIIEncoding.ASCII.GetBytes(IV);
endec.Key = ASCIIEncoding.ASCII.GetBytes(Key);
endec.Padding = PaddingMode.PKCS7;
endec.Mode = CipherMode.CBC;
ICryptoTransform icrypt = endec.CreateDecryptor(endec.Key, endec.IV);
byte[] enc = icrypt.TransformFinalBlock(textbytes, 0, textbytes.Length);
icrypt.Dispose();



if (Form1.verify == password)
{
return System.Text.ASCIIEncoding.ASCII.GetString(enc);

}
else if (Form1.verify != password)
{
MessageBox.Show("Please use the original key file.");
}
}
return encrypted;
}
}
}

Code for Form1:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace EncForTurorial
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void richTextBox1_TextChanged(object sender, EventArgs e)
{

}

public static string password;
private void button1_Click(object sender, EventArgs e)
{
password = textBox1.Text;
string encm = Encryptor.Encrypt(richTextBox1.Text);
System.IO.File.WriteAllText(@"C:\\privatemessage.txt", encm);

}

private void textBox1_TextChanged(object sender, EventArgs e)
{
password = textBox1.Text;
}

private void button2_Click(object sender, EventArgs e)
{
StreamReader sr = new StreamReader(@"C:\\privatemessage.txt");
string line = sr.ReadLine();

richTextBox1.Text = Encryptor.Decrypted(Convert.ToString(line));



}

public static string verify;
private void textBox2_TextChanged(object sender, EventArgs e)
{
verify = textBox2.Text;
}
}
}


c# guitar chord,
c# generics,
c# game programming,
c# guitar tuning,
c# get set,
c# game development,
g#c#f#bd#g#,
c#g#c#f#g#c#,
my sir g c#,
c#g#d#g#cd# tuning,
c# healing frequency,
c# hello world,
c# httpclient,
c# hash table,
c# harmonic minor,
c# hotel management system,
c# hashset,
c# history,
c# interface,
c# interview,
c# inheritance,
c# in unity,
c# intermediate,
c# interview questions,
c# in visual studio code,
c# intermediate tutorial,
c# json,
c# jobs,
c# jazz chords,
c# jam track,
c# java,
c# json tutorial,
c# jwt,
c# jagged array,
j extybt c#,
equinoxe c#- (j.coltrane),
c# kudvenkat,
c# khmer,
c# key,
c# keylogger,
c# keywords,
c# keyboard,
c# kurdish,
c# kafka,
k team c#,
camp r.k.c#309,
r.k.c#309,
k.a.c#252,
c# linq,
c# lambda,
c# list,
c# login form,
c# loops,
c# learning,
c# linked list,
c# lambda expression,
c# minor,
c# major backing track,
c# minor scale,
c# major,
c# methods,
c# mvc,
c# multithreading,
f\




Other Videos By Wassup2190 Tech Tutorials Tricks Computers


2020-10-14Andromeda and Deer Lick Galaxies Through My 8 Inch Telescope Poor Photos
2020-10-13NGC891 Galaxy In My 8 Inch Telescope Poor Photo
2020-10-12Mars On It's 2020 Closest Approach To Earth Shot Through My Telescope
2020-10-11Back Up Your Youtube Channel, Gmail, Google Drive, Photos, Hangouts, Chrome, Classroom To Zip File
2020-10-07How To Scan A Network For Open Ports And Which Programs Apps Protocols Devices are Using Them
2020-10-05How To Fix The iPhone iPad iOS Windows 10 Photo Video Import Error Message Files Not Imported
2020-10-05How Watch Listen Your DVD Movies Audio CD Play Games That Require CD Disk Windows 10 Newer Computer
2020-10-04An Explanation Of The Most Dangerous Computer Virus, the Botnet Virus And How To Protect From Them
2020-09-30Farewell Nintendo 3DS (it's discontinued)
2020-09-30The Moons Craters Shot Through My 8 Inch Telescope
2020-09-30How To Code An AES Text Encryption Program Application In C# NET
2020-09-24Comet Neowise In My 8 inch Telescope
2020-09-20Strange Shortwave Radio Findings I think Cuban Numbers Station HM01 is Sending Fake Messages
2020-09-14How To Play Emulated SNES Roma On An Actual Original Super Nintendo Less Than $100
2020-09-14How To Encrypt Text Files, IM, and Emails Using the Time And Date They Were Created (BOIC)
2020-09-14Tecsun PL 660 Handheld Portable Shortwave HF FM AM SSB Aircraft Radio Receiver Review
2020-09-14An Explanation Of Radio Propogation
2020-09-14A cautionary tale for youtubers who have their account unfairly terminated or striked (yes I'm back)
2020-06-12Strange Shortwave Radio Oddity Signal Findings - Shortwave CODAR And STANAG Faders XF Overlapping
2020-06-10Shortwave Radio Signal Oddity Findings UVB76 The Buzzer clearest capture recording yet
2020-06-06Strange Shortwave Radio Findings Cuban Numbers Station HM01 Overlapped By Another Unknown Station



Tags:
c#
c# programming
learn c#
c# tutorial
c sharp tutorial
c# fundamentals for absolute beginners
c# course
c# for beginners
c# tutorial for beginners
c# (programming language)
.net
c# programming tutorial for beginners
learn c# for beginners
learn c# for unity
unity
learn c# in one video
learn c# programming
.net framework
c# training
csharp
csharp tutorial
c sharp
micrososft



Other Statistics

Counter-Strike: Source Statistics For Wassup2190 Tech Tutorials Tricks Computers

Wassup2190 Tech Tutorials Tricks Computers currently has 37,975 views spread across 2 videos for Counter-Strike: Source. Less than an hour worth of Counter-Strike: Source videos were uploaded to his channel, making up less than 0.83% of the total overall content on Wassup2190 Tech Tutorials Tricks Computers's YouTube channel.