Esempio n. 1
0
        private void button6_Click(object sender, EventArgs e)
        {
            myRSA  my         = new myRSA();
            string privatekey = my.ReadPrivateKey("my.rsa");
            string publickey  = my.ReadPublicKey("my.rsa.pub");
            myMD5  m5         = new myMD5(0, "111");
            string signature  = myRSA.HashAndSignString(m5.getMD5(), privatekey);

            Console.WriteLine(signature.Length);
            byte[] fileLengthArray = Encoding.UTF8.GetBytes(signature);
            Console.WriteLine(fileLengthArray.Length);
            bool b = myRSA.VerifySigned(m5.getMD5(), signature, publickey);
        }
Esempio n. 2
0
        private void button5_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dialog = new FolderBrowserDialog();

            dialog.Description = "请选择文件路径";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string foldPath = dialog.SelectedPath;
                //string PrivateKeyPath = foldPath + "my.rsa";
                //string PublicKeyPath = foldPath + "my.rsa.pub";
                myRSA myrsa = new myRSA();
                //myrsa.RSAKey(PrivateKeyPath, PublicKeyPath);
                myrsa.RSAKey("my.rsa", "my.rsa.pub");
                //MessageBox.Show("已选择文件夹:" + foldPath, "选择文件夹提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }