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);
}
}
}
}
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);
}
}
}
}
相关文章推荐
- licens 问题 Error (292028): Specified license is not valid for this machine
- The specified executable is not a validapplication for this OS platform.
- The specified executable is not a validapplication for this OS platform.
- [SharePoint知识库] 导出List为Template时,提示 The specified gallery is not available for this Web site collection.
- Delphi出现“borland license information was found,but it is not valid for delphi”的错误,无法运行的解决方法
- this class is not key value coding-compliant for the key XXX错误的解决方法
- this class is not key value coding-compliant for the key XXX错误的解决方法
- ORA-15238: 11.2 is not a valid value for attribute compatible.advm 处理方法
- this class is not key value coding-compliant for the key XXX错误的解决方法
- 报错:this class is not key value coding-compliant for the key closeLotTextField解决方法
- JDBC规范-java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]The specified SQL type is not supported by this driver
- 报错:this class is not key value coding-compliant for the key closeLotTextField解决方法
- JVM is not suitable for this product 的第二种解决方法
- Xcode 4: The selected run destination is not valid for this action
- IntelliJ IDEA导入JDK出现The selected directory is not a valid home for JDK问题的解决方法
- RHEL5中出現 “This system is not registered with RHN”的解決方法
- 解决 web service is not a valid method for this service
- VS2005 出现 The OutputPath property is not set for this project. 错误的解决方法
- this class is not key value coding-compliant for the key buttonPressed.' 错误解决方法
- You third iOS app,解决1The identity used to sign the executable is no longer valid 2.A valid provisioning profile for this executable was not found。