Click here to Skip to main content
15,798,804 members
Please Sign up or sign in to vote.
4.73/5 (16 votes)
See more:
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?

_Starbug_ 9-May-14 9:18am    
congratulations. you have more than 1 mega points.congratulation my friend.

See here[^]
Share this answer
Hi You can use Clear() Method on secure memory stream to do is.
Yours Farhad.
Share this answer

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900