Exemple #1
0
        void UpdateForm(X509Certificate2 cert)
        {
            string commonName;
            string countryCode;
            string state;
            string city;
            string organization;
            string unit;
            string email;

            CertTextExtractor.Extract(cert.Issuer, out commonName, out countryCode, out state, out city, out organization, out unit, out email);

            // Update label controls.
            lblOrganizationText.Text = organization;
            lblUnitText.Text         = unit;
            lblLocationText.Text     = string.Format("Country Code: {0}, State: {1}, City: {2}", countryCode, state, city);
            lblCommonNameText.Text   = commonName;

            CertTextExtractor.Extract(cert.Subject, out commonName, out countryCode, out state, out city, out organization, out unit, out email);

            lblOrganizationSubText.Text = organization;
            lblUnitSubText.Text         = unit;
            lblLocationSubText.Text     = string.Format("Country Code: {0}, State: {1}, City: {2}", countryCode, state, city);
            lblCommonNameSubText.Text   = commonName;

            lblFromText.Text = cert.NotBefore.ToString();
            lblToText.Text   = cert.NotAfter.ToString();
        }
Exemple #2
0
        /// <summary>
        /// Handles the form's Load event.
        /// </summary>
        /// <param name="e">The arguments for the event.</param>
        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            string commonName;
            string countryCode;
            string state;
            string city;
            string organization;
            string unit;
            string email;

            CertTextExtractor.Extract(_cert.Issuer, out commonName, out countryCode, out state, out city, out organization, out unit, out email);

            // Update label controls.
            lblIssuerText.Text     = organization;
            lblUnitText.Text       = unit;
            lblLocationText.Text   = string.Format("Country Code: {0}, State: {1}, City: {2}", countryCode, state, city);
            lblCommonNameText.Text = commonName;

            CertTextExtractor.Extract(_cert.Subject, out commonName, out countryCode, out state, out city, out organization, out unit, out email);

            lblOrganizationSubText.Text = organization;
            lblUnitSubText.Text         = unit;
            lblLocationSubText.Text     = string.Format("Country Code: {0}, State: {1}, City: {2}", countryCode, state, city);
            lblCommonNameSubText.Text   = commonName;

            lblFromText.Text = _cert.NotBefore.ToString();
            lblToText.Text   = _cert.NotAfter.ToString();

            txtIssues.Text = _issues;

            btnTrusted.Visible = _showAddToTrustedList;
        }