/// <summary> /// 加密 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnEncrypt_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtSourceText.Text)) { MessageBox.Show("没数据加毛密-_-!"); return; } else { txtResultText.Text = AESEncryptHelper.Encrypt(txtSourceText.Text); } }
/// <summary> /// 解密 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDecrypt_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtSourceText.Text)) { MessageBox.Show("没数据解毛密-_-!"); return; } else if (!IsBase64Formatted(txtSourceText.Text)) { MessageBox.Show("别逗了,我只认识被我加过密的?"); return; } else { txtResultText.Text = AESEncryptHelper.Decrypt(txtSourceText.Text); } }