public async void RSAChange() { await Task.Yield(); RSACryptionTool.BuildRsaKey(out prKey, out PuKey); SetUI(() => { PuKeyText.Text = prKey; PrKeyText.Text = prKey; }); }
private void Button2_Click(object sender, EventArgs e) { var path = DiaShowFilePath("Rsa File (*.RSAEncrypted)|*.RSAEncrypted"); var topath = path.Replace(".RSAEncrypted", ""); if (path is null) { return; } Task.Run(async() => { using (FileStream file = new FileStream(path, FileMode.Open)) { file.Seek(0, SeekOrigin.Begin); await RSACryptionTool.RsaDecrypt(prKey, file, ChangeProgressBar); } FileHelpTool.CopyToFile(FileHelpTool.ProgramPath, topath); }); }
private void Button1_Click(object sender, EventArgs e) { var path = DiaShowFilePath("All files (*.*)|*.*"); if (path is null) { return; } Task.Run(async() => { var topath = path + ".RSAEncrypted"; using (FileStream file = new FileStream(path, FileMode.Open)) { file.Seek(0, SeekOrigin.Begin); await RSACryptionTool.RsaEncrypt(PuKey, file, ChangeProgressBar); } FileHelpTool.CopyToFile(FileHelpTool.ProgramPath, topath); }); }