一个解密文件的方法,它原本是解密时生成新的明文文件的,用的fileStream.但我不想生成明文文件.有没有什么流能够不用生成文件,只存在于内存中的..而且这个流能够用XmlDocument.Load读取的.

解决方案 »

  1.   

    Crypt.DecryptFile2
                MemoryStream fs = new MemoryStream();
               // using (FileStream fs = new FileStream(sourceFile, FileMode.Create, FileAccess.ReadWrite))
                //{                    using (CryptoStream cs = new CryptoStream(fs, des.CreateDecryptor(btKey, btIV), CryptoStreamMode.Write))
                        {
                            cs.Write(btFile, 0, btFile.Length);
                            cs.FlushFinalBlock();
                            
                        }            //}
                        return fs;
    doc=xmldocumentdoc.Load(Crypt.DecryptFile2(filePath, key, iv));执行到Load时提示  无法访问已关闭的流.