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);
                            }
                        }
                    }
                }

  • 相关阅读:
    引入RabbitMQ后,如何保证全链路数据100%不丢
    使用logstash迁移elasticsearch
    内网代理转发工具
    MSSQL存储过程命令执行
    win10 家庭版升级专业版密钥
    clash TUN模式
    windows实战常用命令
    webshell之jsp免杀
    tmux的使用方法
    钓鱼邮件从入门到放弃
  • 原文地址:https://www.cnblogs.com/kzwrcom/p/6879853.html
Copyright © 2011-2022 走看看