欢迎访问 生活随笔!

凯发k8官方网

当前位置: 凯发k8官方网 > 编程语言 > c# >内容正文

c#

c# aes cryptostream specified padding mode is not valid for this algorithm的解決方法 -凯发k8官方网

发布时间:2024/10/12 c# 30 豆豆
凯发k8官方网 收集整理的这篇文章主要介绍了 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);
                        }
                    }
                }
            }

转载于:https://www.cnblogs.com/kzwrcom/p/6879853.html

总结

以上是凯发k8官方网为你收集整理的c# aes cryptostream specified padding mode is not valid for this algorithm的解決方法的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得凯发k8官方网网站内容还不错,欢迎将凯发k8官方网推荐给好友。

网站地图