예제 #1
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            if (KeyNameTextBox.Text != string.Empty)
            {
                key.KeyName = KeyNameTextBox.Text;
            }
            else
            {
                key.KeyName = RSAEncryptor.ValidateKeyName("Chave");
            }

            key.encryptionMode = (Key.EncryptionMode)EncryptionModeDropdown.SelectedItem;

            if (key.encryptionMode == Key.EncryptionMode.Automatic)
            {
                SaveAutomaticKey();
            }
            else
            {
                SaveManualKey();
            }

            KeysTab.UpdateKeysList();
            RSAEncryptor.UpdateKeysList();
        }
예제 #2
0
        public RSAEncryptor()
        {
            InitializeComponent();

            instance       = this;
            keys.AllowEdit = true;
            keys.RaiseListChangedEvents = true;
        }
예제 #3
0
        private void AddKeyButton_Click(object sender, EventArgs e)
        {
            string newKeyName = RSAEncryptor.ValidateKeyName("Nova Chave");
            var    key        = new Key();

            key.SetName(newKeyName);
            RSAEncryptor.AddKey(key);

            AddKey(newKeyName);
            KeysList.CurrentCell = KeysList.Rows[KeysList.Rows.Count - 1].Cells[0];

            UpdateItemsSize();
        }
예제 #4
0
        private void KeysList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var grid = sender as DataGridView;

            if (grid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
            {
                if (e.ColumnIndex == 1)
                {
                    RSAEncryptor.OpenKeyEdit(true, RSAEncryptor.keys[e.RowIndex]);
                }
                else if (e.ColumnIndex == 2)
                {
                    RSAEncryptor.RemoveKey(e.RowIndex);
                    grid.Rows.RemoveAt(e.RowIndex);
                    KeysList.ClearSelection();
                    UpdateItemsSize();
                }
            }
        }
예제 #5
0
        private void UpdateItemsSize()
        {
            for (int i = 0; i < KeysList.Rows.Count; i++)
            {
                var row = KeysList.Rows[i];
                row.Height = (int)(KeysList.Size.Height * 0.125f);
            }

            for (int i = 0; i < KeysList.Columns.Count; i++)
            {
                var column = KeysList.Columns[i];
                column.DefaultCellStyle.Font = new Font("Arial", RSAEncryptor.GetDynamicFontSize(15), FontStyle.Regular);

                bool isScrollbarVisible = false;

                foreach (var scroll in KeysList.Controls.OfType <VScrollBar>())
                {
                    if (scroll.Visible)
                    {
                        isScrollbarVisible = true;
                        break;
                    }
                }

                int scrollWidth = isScrollbarVisible ? SystemInformation.VerticalScrollBarWidth : 0;

                if (i == 0)
                {
                    column.Width = (int)((KeysList.Size.Width - scrollWidth) * 0.6f);
                }
                else
                {
                    column.Width = (int)((KeysList.Size.Width - scrollWidth) * 0.2f);
                }
            }
        }
 private void ResizeTexts()
 {
     RSAEncryptor.ResizeTexts(15, KeyInfoLayout);
     RSAEncryptor.ResizeText(25, KeyName);
 }
 private void EditButton_Click(object sender, EventArgs e)
 {
     RSAEncryptor.OpenKeyEdit(true, key);
 }
 private void ResizeTexts()
 {
     RSAEncryptor.ResizeTexts(15, EncryptorLayout, EncryptionPanel, DecryptionPanel);
     RSAEncryptor.ResizeText(25, EncryptionKeysDropdown);
     RSAEncryptor.ResizeText(25, DecryptionKeysDropdown);
 }
예제 #9
0
 private void ResizeTexts()
 {
     RSAEncryptor.ResizeTexts(14, EditLayout, KeysLayout, PublicKeyValidationPanel, PrivateKeyValidationPanel);
 }
예제 #10
0
 private void ResizeTexts()
 {
     RSAEncryptor.ResizeTexts(15, KeyEditTabLayout, AutoEditLayout, PublicKeyValidationPanel, PrivateKeyValidationPanel);
     RSAEncryptor.ResizeText(25, EncryptionModeDropdown);
 }
예제 #11
0
        private void BackButton_Click(object sender, EventArgs e)
        {
            EditPanel.Controls.Remove(manualKeyEditor);

            RSAEncryptor.OpenKeyEdit(false);
        }
예제 #12
0
 private void ResizeTexts()
 {
     RSAEncryptor.ResizeTexts(15, KeysTabLayout);
 }
예제 #13
0
 private void SaveChangesButton_Click(object sender, EventArgs e)
 {
     RSAEncryptor.SaveKeysData();
 }
예제 #14
0
 private void RevertButton_Click(object sender, EventArgs e)
 {
     RSAEncryptor.LoadKeysData();
     UpdateKeysList();
 }
예제 #15
0
 private void RemoveAllButton_Click(object sender, EventArgs e)
 {
     RSAEncryptor.RemoveAllKeys();
     KeysList.Rows.Clear();
 }