-
Notifications
You must be signed in to change notification settings - Fork 10
/
FrmMain.cs
48 lines (42 loc) · 1.59 KB
/
FrmMain.cs
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
using System;
using System.Windows.Forms;
namespace AndroidQQ_8_4_1_4680_ECDH
{
public partial class FrmMain : Form
{
public FrmMain()
{
InitializeComponent();
}
private void BtnClientGenKeys_Click(object sender, EventArgs e)
{
EcdhCrypt ecdh = new EcdhCrypt();
ecdh.GenEcdhKeys();
txtClientPubkey.Text = ecdh.GetPublicKeyHex();
txtClientPrikey.Text = ecdh.GetPrivateKeyHex();
}
private void BtnServerGenKeys_Click(object sender, EventArgs e)
{
EcdhCrypt ecdh = new EcdhCrypt();
ecdh.GenEcdhKeys();
txtServerPubkey.Text = ecdh.GetPublicKeyHex();
txtServerPrikey.Text = ecdh.GetPrivateKeyHex();
}
private void BtnExchangePubkey_Click(object sender, EventArgs e)
{
string clientPubkey = txtClientPubkey.Text;
txtClientPubkey.Text = txtServerPubkey.Text;
txtServerPubkey.Text = clientPubkey;
}
private void BtnClientGenShakey_Click(object sender, EventArgs e)
{
EcdhCrypt ecdh = new EcdhCrypt();
txtClientShakey.Text = ecdh.GenShareKeyHex(txtClientPubkey.Text.ToBytes(), txtClientPrikey.Text.ToBytes());
}
private void BtnServerGenShakey_Click(object sender, EventArgs e)
{
EcdhCrypt ecdh = new EcdhCrypt();
txtServerShakey.Text = ecdh.GenShareKeyHex(txtServerPubkey.Text.ToBytes(), txtServerPrikey.Text.ToBytes());
}
}
}