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


     //解密數據
                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);
                            }
                        }
                    }
                }

  • 相关阅读:
    MySQL 5.7笔记
    Golang学习笔记
    Ubuntu使用笔记
    Linux下安装nginx和php
    Eclipse远程调试Java程序
    CentOS下glibc更新
    Linux服务器运行环境搭建(三)——MySQL数据库安装
    Linux服务器运行环境搭建(二)——Redis数据库安装
    Linux下定时任务Crontab的使用
    Linux下nginx安装与配置
  • 原文地址:https://www.cnblogs.com/kzwrcom/p/6879853.html
Copyright © 2020-2023  润新知