63 lines
1.4 KiB
C#
63 lines
1.4 KiB
C#
using System.Security;
|
|
using System.Security.Cryptography;
|
|
using System.Security.Cryptography.X509Certificates;
|
|
using System.Text;
|
|
using ElectronicSignature.Certification;
|
|
using Org.BouncyCastle.Crypto.Parameters;
|
|
using Org.BouncyCastle.Security;
|
|
|
|
namespace AppView
|
|
{
|
|
public partial class FormMain : Form
|
|
{
|
|
private static readonly string keyPairPath = @"G:\tests\rsaKeyPair.pem";
|
|
public static int keySize = 50;
|
|
public FormMain()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
private void buttonFilePath_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void buttonKeyPath_Click(object sender, EventArgs e)
|
|
{
|
|
using var dialog = new OpenFileDialog { Filter = "pem|*.pem" };
|
|
if (dialog.ShowDialog() == DialogResult.OK)
|
|
{
|
|
textBoxKeyPath.Text = dialog.FileName;
|
|
}
|
|
}
|
|
|
|
private void buttonWriteKey_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
private void buttonCheckKey_Click(object sender, EventArgs e)
|
|
{
|
|
}
|
|
|
|
private void buttonGenerateKeyRSA_Click(object sender, EventArgs e)
|
|
{
|
|
}
|
|
|
|
private void ñîçäàòüToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
var keyPair = Cryptography.GenerateRSAKeyPair();
|
|
keyPair.ToPemFile(keyPairPath);
|
|
|
|
MessageBox.Show("Êëþ÷è ñîçäàíû");
|
|
}
|
|
|
|
private void ñïèñîêToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
var service = Program.ServiceProvider?.GetService(typeof(FormKeys));
|
|
|
|
if (service is FormKeys form)
|
|
{
|
|
form.ShowDialog();
|
|
}
|
|
}
|
|
}
|
|
} |