zoukankan      html  css  js  c++  java
  • 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);
                            }
                        }
                    }
                }

  • 相关阅读:
    java并发计算的几种基本使用示例
    axios、ajax和xhr前端发送测试
    Spring注解
    Android菜鸟教程笔记
    普通二叉树操作
    MyBatis
    mysql的select语句总结与索引使用
    sys.argv的意义[转]
    硬件小白学习之路(1)稳压芯片LM431
    FPGA小白学习之路(6)串口波特率问题的处理
  • 原文地址:https://www.cnblogs.com/kzwrcom/p/6879853.html
Copyright © 2011-2022 走看看