private void btnCreate_Click(object sender, EventArgs e)
{
IsValid = false;
Certificate cert = new Certificate(txtCer.Text, txtKey.Text, txtPassword.Text);
X509Certificate2 xcert = null;
try
{
if (string.IsNullOrEmpty(cert.PrivateKey))
{
xcert = cert.GetCertificateFromPEMstring(true);
}
else
{
xcert = cert.GetCertificateFromPEMstring(false);
}
}
catch (Exception ex)
{
MessageBox.Show(string.Format("An error occure during certificate creation: Error {0}", ex.Message));
pictureBox1.Image = new Bitmap("red_light.png");
return;
}
pictureBox1.Image = new Bitmap("green_light.png");
IsValid = true;
}