private X509Certificate2 GenerateCert()
        {
            BackgroundCertGenForm form = new BackgroundCertGenForm();

            form.CertProperties = new SelfSignedCertProperties
            {
                Name                   = new X500DistinguishedName(txtDN.Text),
                ValidFrom              = dtpValidFrom.Value,
                ValidTo                = dtpValidTo.Value,
                KeyBitLength           = int.Parse(cboKeySize.Text),
                IsPrivateKeyExportable = true,
            };
            form.ShowDialog();

            return(form.Certificate);
        }
        private X509Certificate2 GenerateCert()
        {
            // use a form to initiate a cancellable background worker
            BackgroundCertGenForm form = new BackgroundCertGenForm();

            form.CertProperties = new SelfSignedCertProperties
            {
                Name      = new X500DistinguishedName(txtDN.Text),
                ValidFrom = dtpValidFrom.Value,
                ValidTo   = dtpValidTo.Value,
                RootCertificateAuthority = _selectedCertificates != null && _selectedCertificates.Count == 0 ? null : _selectedCertificates[0],
                KeyBitLength             = int.Parse(cboKeySize.Text),
                IsPrivateKeyExportable   = true,
            };
            form.ShowDialog();

            return(form.Certificate);
        }
        private X509Certificate2 GenerateCert()
        {
            // use a form to initiate a cancellable background worker
            BackgroundCertGenForm form = new BackgroundCertGenForm();
            form.CertProperties = new SelfSignedCertProperties
            {
                Name = new X500DistinguishedName(txtDN.Text),
                ValidFrom = dtpValidFrom.Value,
                ValidTo = dtpValidTo.Value,
                KeyBitLength = int.Parse(cboKeySize.Text),
                IsPrivateKeyExportable = true,
            };
            form.ShowDialog();

            return form.Certificate;
        }