private void toolStripMenuItemExport_Click(object sender, EventArgs e)
        {
            string saveFile = DialogHelper.SaveFileDialog();

            if (!string.IsNullOrEmpty(saveFile))
            {
                CertificateRow row   = GetSelectedRow();
                byte[]         bytes = row.certificate.Export(X509ContentType.Cert);
                File.WriteAllBytes(saveFile, bytes);
            }
        }
Example #2
0
        public static List <CertificateRow> FromStore(X509Store store)
        {
            List <CertificateRow> results = new List <CertificateRow>();

            foreach (X509Certificate2 cert in store.Certificates)
            {
                CertificateRow newRow = new CertificateRow(cert);
                newRow.StoreName     = store.Name;
                newRow.StoreLocation = store.Location.ToString();
                results.Add(newRow);
            }
            return(results);
        }
        private void HighlightExpiredCertificateCells()
        {
            certificateRowCollection.VerifyAllCerts();

            foreach (DataGridViewRow row in dataGridViewCertificates.Rows)
            {
                CertificateRow certRow = (CertificateRow)row.DataBoundItem;
                if (certRow.HasErrors)
                {
                    row.DefaultCellStyle.BackColor = Color.MistyRose;
                    DataGridViewCell cell = row.Cells[certRow.ErrorProperty];
                    if (cell != null)
                    {
                        cell.ErrorText = certRow.ErrorText;
                    }
                }
            }
        }
        private void toolStripMenuItemDelete_Click(object sender, EventArgs e)
        {
            CertificateRow row = GetSelectedRow();

            row.Remove();
        }
        private void toolStripMenuItemOpen_Click(object sender, EventArgs e)
        {
            CertificateRow row = GetSelectedRow();

            X509Certificate2UI.DisplayCertificate(row.certificate);
        }