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); }
private void button3_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); //ofd.Filter = "Excel文件(*.xls;*.xlsx)|*.xls;*.xlsx|所有文件|*.*"; ofd.ValidateNames = true; ofd.CheckPathExists = true; ofd.CheckFileExists = true; ofd.Multiselect = false; if (ofd.ShowDialog() == DialogResult.OK) { this.txtIn.Text = ofd.FileName; myMD5 md5 = new myMD5(1, ofd.FileName); this.txtOut.Text = md5.getMD5(); //其他代码 } }
private void button1_Click(object sender, EventArgs e) { myMD5 md5 = new myMD5(0, this.txtIn.Text); this.txtOut.Text = md5.getMD5(); }