您的位置:首页 > 编程语言 > C#

C# Aes CryptoStream Specified padding mode is not valid for this algorithm的解決方法

2017-05-19 18:29 507 查看
//解密數據
using (var ss = File.OpenRead(@"d:\qq.d.flac"))
{
using (FileStream w = new FileStream(@"d:\qq.flac", FileMode.Create))
{
using (var cs = AesStream.StreamDecrypt(w, "qq"))
{
ss.Seek(0, SeekOrigin.Begin);
for (int i = 0; i < ss.Length; i += 4096)
{
byte[] chunkData = new byte[4096];
int bytesRead = 0;

         //Updates the underlying data source or repository with the current state of the buffer, then clears the buffer.
if (!cs.HasFlushedFinalBlock)
{
cs.FlushFinalBlock();
}
bytesRead = ss.Read(chunkData, 0, chunkData.Length);

if (i > 4096*1024)
{
break;
}
cs.Write(chunkData, 0, bytesRead);
}
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐