Пример #1
0
 private void BtnDecrypt_Click(object sender, RoutedEventArgs e)
 {
     if (tbPassword.Text.Length < 5)
     {
         MessageBox.Show("密码长度不能低于5位");
         return;
     }
     AesHelp.GenKeyIV(tbPassword.Text, out key, out iv);
     //解密
     byte[] data = Convert.FromBase64String(this.tbEncrypt.Text);
     this.tbDecrypt.Text = AesHelp.DecryptString(data, key, iv);
 }
Пример #2
0
 private void BtnEncrypt_Click(object sender, RoutedEventArgs e)
 {
     if (tbPassword.Text.Length < 5)
     {
         MessageBox.Show("密码长度不能低于5位");
         return;
     }
     AesHelp.GenKeyIV(tbPassword.Text, out key, out iv);
     //加密
     byte[] encryptData = AesHelp.EncryptString(tbOriginal.Text, key, iv);
     this.tbEncrypt.Text = Convert.ToBase64String(encryptData);
 }