Exemple #1
0
        private void btnCreateKeys_Click(object sender, EventArgs e)
        {
            try
            {
                QuickRSA.CreateKeyPair(dirBrowser1.TextBox.Text, int.Parse(txtBits.Text));
            }
            catch (Exception ex)
            {
                StdMsgBox.Error(ex.Message);
                return;
            }

            StdMsgBox.OK("Keys created.");
        }
Exemple #2
0
        public void RSA_PaddingTest(string str)
        {
            QuickRSA rsa = new QuickRSA();

            QuickRSA.CreateKeyPair("..\\..\\test\\keys");
            rsa.LoadKeys("..\\..\\test\\keys\\pri.key", "..\\..\\test\\keys\\pub.key");

            byte[] data     = Encoding.ASCII.GetBytes(str);
            int    data_len = data.Length;

            byte[] enc_data     = rsa.Encrypt(data);
            int    enc_data_len = enc_data.Length;

            // is this right
            Assert.AreEqual(256, enc_data_len);
        }