private void CertificateBTN_Click(object sender, EventArgs e)
{
try
{
// determine default store.
CertificateStoreIdentifier store = new CertificateStoreIdentifier();
if (m_certificate != null)
{
store.StoreType = m_certificate.StoreType;
store.StorePath = m_certificate.StorePath;
}
else
{
store.StoreType = Utils.DefaultStoreType;
store.StorePath = Utils.DefaultStorePath;
}
// select the certificate.
CertificateIdentifier certificate = new CertificateListDlg().ShowDialog(store, true);
if (certificate != null)
{
m_certificate = certificate;
X509Certificate2 certificate2 = m_certificate.Find();
if (certificate2 != null)
{
CertificateTB.Text = certificate2.Subject;
}
else
{
CertificateTB.Text = m_certificate.ToString();
}
}
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, System.Reflection.MethodBase.GetCurrentMethod(), exception);
}
}