/// <summary> /// 檔案放下時 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private new void DragDrop(object sender, DragEventArgs e) { string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop); //解密私鑰路徑 string privateKey = $"{ this.textBoxDecryptKeyPath.Text}"; var DecryptTxet = RSAKit.Decrypt(File.ReadAllText(filePaths[0]), privateKey); this.textBoxDecryptContent.Text = DecryptTxet; }
public void DecryptTest() { BigInteger expected = new BigInteger(2); BigInteger input = new BigInteger(128); kit.E = BigInteger.Parse("7"); kit.P = BigInteger.Parse("17"); kit.Q = BigInteger.Parse("11"); kit.N = kit.Create_n(); kit.D = kit.Gcd_inv_R(); BigInteger result = kit.Decrypt(input); Assert.AreEqual(expected, result); }