Beispiel #1
0
 private void buttonRecRSALoad_Click(object sender, EventArgs e)
 {
     if (busy)
     {
         return;
     }
     try
     {
         using (FileStream fs = new FileStream(Program.RSA_PRIVATE_FILE_NAME, FileMode.Open))
         {
             BinaryFormatter bf = new BinaryFormatter();
             ReceiverRSA = bf.Deserialize(fs) as RSA.RSA;
         }
     }
     catch
     {
         if (sender != null)
         {
             MessageError("私钥 " + Program.RSA_PRIVATE_FILE_NAME + " 读取失败,请重新生成RSA密钥对");
         }
         ReceiverRSA        = null;
         textBoxRecRSA.Text = "";
         return;
     }
     if (sender != null)
     {
         MessageHint("私钥 " + Program.RSA_PRIVATE_FILE_NAME + " 读取成功!");
     }
     textBoxRecRSA.Text = ReceiverRSA.ToString();
 }
Beispiel #2
0
 private void buttonRecRSANew_Click(object sender, EventArgs e)
 {
     if (busy)
     {
         return;
     }
     ReceiverRSA        = new RSA.RSA(16);
     textBoxRecRSA.Text = ReceiverRSA.ToString();
     Log("已生成新RSA密钥对,记得要保存才能生效");
 }