69 lines
2.2 KiB
C#
69 lines
2.2 KiB
C#
//----------------------------------------------------------------------------
|
|
//
|
|
// Copyright © 2009-2012, Intel Corporation. All rights reserved.
|
|
//
|
|
// File: CertWarning.cs
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using System.Security.Cryptography;
|
|
using System.Security.Cryptography.X509Certificates;
|
|
|
|
namespace UCT.Forms
|
|
{
|
|
/// <summary>
|
|
/// Warning form - displayed when there is an issue with the certificate.
|
|
/// Ask the user - if he wants to continue even if there is a security issue.
|
|
/// </summary>
|
|
public partial class CertWarning : Form
|
|
{
|
|
#region - Constructors -
|
|
|
|
public CertWarning(string description)
|
|
{
|
|
InitializeComponent();
|
|
lblProblemDescription.Text = description;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region - Methods -
|
|
|
|
private void lbContinue_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
{
|
|
this.DialogResult = DialogResult.Cancel;
|
|
}
|
|
|
|
private void lbCloseConnection_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
{
|
|
this.DialogResult = DialogResult.Yes;
|
|
}
|
|
|
|
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
{
|
|
if (Configuration.CertificateSettings.GetInstance().PersonalCertificate != string.Empty)
|
|
{
|
|
linkViewCert.Visible = true;
|
|
}
|
|
}
|
|
|
|
private void linkViewCert_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
X509Certificate2UI.DisplayCertificate(Configuration.CertificateSettings.GetInstance().ServerCertificate, this.Handle);
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
LogManager.WriteOperation(LogLevel.BASIC, string.Format(Properties.Resources.OPERATION_FAILED, "Display Certificate"), LogInteraction.Error);
|
|
AMT_SW_GUI.MessageManager.ShowErrorMessage(ex.Message, "Failed to display certificate", this);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|