-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
53 lines (46 loc) · 1.5 KB
/
Program.cs
File metadata and controls
53 lines (46 loc) · 1.5 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
using System;
using SerialCrypt;
using System.Collections.Generic;
namespace crypttest
{
class MainClass
{
[Serializable]
public class Data
{
public string name;
public Dictionary<string, string> _credentials;
public Data()
{
_credentials = new Dictionary<string, string>();
}
}
public static void Main(string[] args)
{
Data sd = new Data();
sd.name = "ATC doesn’t care what VFR traffic is doing below 1200 ft AGL because IFR";
sd._credentials.Add("testing", "test");
sd._credentials.Add("Hello", "World");
Console.WriteLine("InputData: "+ sd.name);
foreach (var v in sd._credentials)
Console.WriteLine(v.Key + " " + v.Value);
string pw = "Hello World!";
EncryptDecrypt encryptDecrypt = new EncryptDecrypt();
byte[] benc = encryptDecrypt.Encrypt(sd, pw);
Data d = null;
try
{
d = encryptDecrypt.Decrypt<Data>(benc, pw);
}
catch (Exception e)
{
Console.WriteLine("Decryption Error: Check password and retry");
return;
}
Console.WriteLine("Output Data: " + d.name);
foreach(var v in d._credentials)
Console.WriteLine(v.Key + " " + v.Value);
}
}
}