Beispiel #1
0
        /// <summary>
        /// Button "Generate" in domain configuration action - Generate a new private key file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btGenerate_Click(object sender, EventArgs e)
        {
            byte[] binaryData = RSACryptoHelper.GenerateXMLEncodedRsaPrivateKey();
            string domain     = dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[0].Value.ToString();
            string selector   = dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[1].Value.ToString();

            PrivateKeyWindows form = new PrivateKeyWindows(domain, selector);

            form.ShowDialog();

            dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[2].Value = form.txtFilename.Text;

            if (attachments.ContainsKey(dgvDomainConfiguration.SelectedCells[0].RowIndex))
            {
                attachments[dgvDomainConfiguration.SelectedCells[0].RowIndex] = binaryData;
            }
            else
            {
                attachments.Add(dgvDomainConfiguration.SelectedCells[0].RowIndex, binaryData);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Open private key information by clicking in private key file in the dgvDomainConfiguration DataGridView
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvDomainConfiguration_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            string domain   = string.Empty;
            string selector = string.Empty;
            string filename = string.Empty;

            if (dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[0].Value != null)
            {
                domain = dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[0].Value.ToString();
            }

            if (dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[1].Value != null)
            {
                selector = dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[1].Value.ToString();
            }

            if (dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[2].Value != null)
            {
                filename = dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[2].Value.ToString();
            }

            if (e.ColumnIndex == 2 && domain != string.Empty && selector != string.Empty && filename != string.Empty)
            {
                byte[] binaryData = attachments[dgvDomainConfiguration.SelectedCells[2].RowIndex];

                PrivateKeyWindows form = new PrivateKeyWindows(domain, selector, filename);
                form.ShowDialog();

                if (dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[2].Value.ToString() != form.txtFilename.Text)
                {
                    this.dataUpdated = true;

                    dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[2].Value = form.txtFilename.Text;
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Open private key information by clicking in private key file in the dgvDomainConfiguration DataGridView
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvDomainConfiguration_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            string domain = string.Empty;
            string selector = string.Empty;
            string filename = string.Empty;

            if (dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[0].Value != null)
                domain = dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[0].Value.ToString();

            if (dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[1].Value != null)
                selector = dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[1].Value.ToString();

            if (dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[2].Value != null)
                filename = dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[2].Value.ToString();

            if (e.ColumnIndex == 2 && domain != string.Empty && selector != string.Empty && filename != string.Empty)
            {
                byte[] binaryData = attachments[dgvDomainConfiguration.SelectedCells[2].RowIndex];

                PrivateKeyWindows form = new PrivateKeyWindows(domain, selector, filename);
                form.ShowDialog();

                if (dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[2].Value.ToString() != form.txtFilename.Text)
                {
                    this.dataUpdated = true;

                    dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[2].Value = form.txtFilename.Text;
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Button "Generate" in domain configuration action - Generate a new private key file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btGenerate_Click(object sender, EventArgs e)
        {
            byte[] binaryData = RSACryptoHelper.GenerateXMLEncodedRsaPrivateKey();
            string domain = dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[0].Value.ToString();
            string selector = dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[1].Value.ToString();

            PrivateKeyWindows form = new PrivateKeyWindows(domain, selector);
            form.ShowDialog();

            dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[2].Value = form.txtFilename.Text;

            if (attachments.ContainsKey(dgvDomainConfiguration.SelectedCells[0].RowIndex))
            {
                attachments[dgvDomainConfiguration.SelectedCells[0].RowIndex] = binaryData;
            }
            else
            {
                attachments.Add(dgvDomainConfiguration.SelectedCells[0].RowIndex, binaryData);
            }
        }