private async void Btn_Encrypt_ClickAsync(object sender, EventArgs e) { if (Rdb_RsaEncrypt.Checked) { var Enc = await Rsa.EncryptAsync(Txt_PublicKey.Text, Txt_PlainText.Text); Txt_CipherText.Text = Enc; } else { try { AESCryptography Aes = new AESCryptography(); var Enc = Aes.EncryptAsync(Txt_PublicKey.Text, Txt_PlainText.Text); Txt_CipherText.Text = Enc; } catch (Exception ex) { MessageBox.Show(ex.GetErrorMessage()); } } }