示例#1
0
        void generateKeys()
        {
            UseWaitCursor = true;
            string keyLength = comboBox1.SelectedValue.ToString();

            textBox3.Text = RSAservice.generateKeyPair(keyLength);
            UseWaitCursor = false;
        }
示例#2
0
        void startup()
        {
            comboBox1.DataSource = RSAservice.getPossibleKeyLengths();
            //comboBox3.DataSource = MyKey.getKeyNames();
            numericUpDown2.Value = 32;

            textBox4.Enabled = false;
            textBox5.Enabled = false;
            //comboBox3.Enabled = false;
            button1.Enabled = false;
            button2.Enabled = false;
            loadSettings();
        }
示例#3
0
        void signMessage()
        {
            using (FrmSelectKey frmSelectKey = new FrmSelectKey(0))
            {
                frmSelectKey.ShowDialog(this);
            }

            if (key != null)
            {
                string msg = textBox1.Text;
                msgSign = RSAservice.sign(key, msg);
            }

            key = null;
        }
示例#4
0
        void verifySign()
        {
            using (FrmSelectKey frmSelectKey = new FrmSelectKey(1))
            {
                frmSelectKey.ShowDialog(this);
            }

            if (key != null)
            {
                string msg = textBox1.Text;

                if (RSAservice.verify(key, msg, msgSign))
                {
                    MessageBox.Show("Podpis prawidłowy!", "Weryfikacja", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Podpis nieprawidłowy!", "Weryfikacja", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
示例#5
0
 void getKeyLength()
 {
     //Setting.get();
     comboBox1.DataSource    = RSAservice.getPossibleKeyLengths();
     comboBox1.SelectedIndex = comboBox1.FindStringExact(Setting.rsaKeyLength.ToString());
 }