-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.cs
More file actions
87 lines (69 loc) · 3.46 KB
/
App.cs
File metadata and controls
87 lines (69 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using MultiLayered_Encryptor_App.Algorithms;
namespace MultiLayered_Encryptor_App {
public partial class App : Form {
public App() {
InitializeComponent();
this.BackgroundImage = Properties.Resources.mle;
BackgroundImageLayout = ImageLayout.Stretch;
}
private void Form1_Load(object sender, EventArgs e) {
bool bIsMLE = false;
// checking for Multi-Layered Encryption in Algorithms
if(comboBox_Algorithm.Text != "Multi-Layered Encryption") {
label_MLE.Visible = false;
comboBox_MLEBits.Visible = false;
} else if(comboBox_Algorithm.Text != "Multi-Layered Encryption") {
label_MLE.Visible = true;
comboBox_MLEBits.Visible = true;
}
}
private void button_Transform_Click(object sender, EventArgs e) {
// AES-Advanced Encryption Standard
if (comboBox_Algorithm.Text == "AES-Advanced Encryption Standard") {
if (comboBox_TypeToPerform.Text == "Encrypt") {
Stopwatch stopwatch = Stopwatch.StartNew();
label_ProcessTracker.Visible = true;
label_ProcessTracker.Text = "Processing . . .";
string key = KeyGenerator.GetRandomAlphanumericString(32);
textBox_OutputText.Text = AES.EncryptString(key, textBox_InputText.Text);
textBox_KeyAfterEncrypt.Text = key;
stopwatch.Stop();
label_ProcessTracker.Text = String.Format("Completed in {0} seconds.", stopwatch.ElapsedMilliseconds / 1000.0);
} else if(comboBox_TypeToPerform.Text == "Decrypt") {
Stopwatch stopwatch = Stopwatch.StartNew();
label_ProcessTracker.Visible = true;
label_ProcessTracker.Text = "Processing . . .";
textBox_OutputText.Text = AES.DecryptString(textBox_KeyToDecrypt.Text, textBox_InputText.Text);
stopwatch.Stop();
label_ProcessTracker.Text = String.Format("Completed in {0} seconds.", stopwatch.ElapsedMilliseconds / 1000.0);
}
}
// Rijindael Algorithm
if (comboBox_Algorithm.Text == "") {
if (comboBox_TypeToPerform.Text == "Encrypt") {
Stopwatch stopwatch = Stopwatch.StartNew();
label_ProcessTracker.Visible = true;
label_ProcessTracker.Text = "Processing . . .";
stopwatch.Stop();
label_ProcessTracker.Text = String.Format("Completed in {0} seconds.", stopwatch.ElapsedMilliseconds / 1000.0);
} else if (comboBox_TypeToPerform.Text == "Decrypt") {
Stopwatch stopwatch = Stopwatch.StartNew();
label_ProcessTracker.Visible = true;
label_ProcessTracker.Text = "Processing . . .";
stopwatch.Stop();
label_ProcessTracker.Text = String.Format("Completed in {0} seconds.", stopwatch.ElapsedMilliseconds / 1000.0);
}
}
}
}
}