破坏托管变量的内容 [英] Trashing the content of managed variables

查看:93
本文介绍了破坏托管变量的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用加密技术的应用程序,主要是在流(文件和内存)中,我根据需要将其解密到新的MemoryStream中。所有这一切都运行良好。
唯一的问题是,当我完成它时,我想要删除MemoryStream的内容(以及字符串等我将部分复制到其中)以防止它以解密的形式被分页到磁盘通过交换文件。
在老式的C ++中,我会在删除它之前用随机垃圾突击显示数据 - 管理对象有什么办法吗?

解决方案

参见这里 [ ^ ]


Hi
您可以在安全内存流上使用Clear()方法。

Yours Farhad。

I have an application using cryptography, mostly in streams (file and memory) which I decrypt as needed into a new MemoryStream. All this works well.
Only thing is, I would like to trash the content of the MemoryStream when I am done with it (as well as strings etc I copy portions into) to prevent it ever getting paged to disk in decrypted form via the swap file.
In "good old fashioned" C++ I would just blitz the data with random rubbish before I deleted it - is there any way with managed objects?

解决方案

See here[^]


Hi You can use Clear() Method on secure memory stream to do is.
Yours Farhad.


这篇关于破坏托管变量的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆