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

  • 相关阅读:
    自定义的tabBarController的几种方法
    JAVA如何把一个float四舍五入到小数点后2位,4位,或者其它指定位数.
    ALAssetsLibrary使用
    UITabBarController详解
    学习笔记:Tab Bar 控件使用详解
    iOS开发 跳转场景的三种方式
    Java中文件与字节数组转换
    'NSUnknownKeyException', reason:....etValue:forUndefinedKey:]: this class is not key value coding-compliant for the key
    开源项目
    object-c的异常处理机制
  • 原文地址:https://www.cnblogs.com/kzwrcom/p/6879853.html
Copyright © 2011-2022 走看看