码迷,mamicode.com
首页 > Web开发 > 详细

.net 加密错误:填充无效,无法移除

时间:2014-08-12 00:08:23      阅读:653      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   使用   for   div   new   log   

今天用System.Security.Cryptography加密。使用了AesManaged,报错:填充无效,无法移除。分析是解密失败,密文损坏,或者KEY,IV不正确。

using (AesManaged aesAlg = new AesManaged())
{
    aesAlg.Key = Encoding.Unicode.GetBytes("password");
    aesAlg.IV = aesAlg.Key;

     using (ICryptoTransform decryptor = aesAlg.CreateDecryptor())
                {
                    return decryptor.TransformFinalBlock(cipherBytes, 0, cipherBytes.Length);
                }

 }

.net 加密错误:填充无效,无法移除,布布扣,bubuko.com

.net 加密错误:填充无效,无法移除

标签:style   blog   color   使用   for   div   new   log   

原文地址:http://www.cnblogs.com/bushuosx/p/3905668.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!