문제

Possible Duplicate:
C# - Deleting a file permanently

Hello,

I am using C# .NET Framework 2.0. I have a question relating to file shredding.

My target operating systems are Windows 7, Windows Vista, and Windows XP. Possibly Windows Server 2003 or 2008 but I'm guessing they should be the same as the first three.

My goal is to securely erase a file.

I don't believe using File.Delete is secure at all. I read somewhere that the operating system simply marks the raw hard-disk data for deletion when you delete a file - the data is not erased at all. That's why there exists so many working methods to recover supposedly "deleted" files. I also read, that's why it's much more useful to overwrite the file, because then the data on disk actually has to be changed. Is this true? Is this generally what's needed?

If so, I believe I can simply write the file full of 1's and 0's a few times.

I've read: http://www.codeproject.com/KB/files/NShred.aspx http://blogs.computerworld.com/node/5756 http://blogs.computerworld.com/node/5687 Securely deleting a file in C#.NET

도움이 되었습니까?

해결책

I'm afraid that you are facing a complex issue. I would suggest not to try to solve it by your own.

Note that beside ensuring a physical overwrite of the file (which may be over LAN, flash, or whatever), you'll have to take care of any application caches, windows hibernate files, windows recovery files, windows swap file, and all copies or older erased versions of this files (swap all empty space, or worse, space that contained cache before, and may have been allocated to other files since) - all in the correct order.

I think that your chances can be better if you are able to store your files on a dedicated logical (or even physical) drive, which is not used by the OS or by other applications, and if you'll convince Windows not to swap the memory you are using to hold the file, while in RAM (using VirtualLock()). Still, you should erase swap, cache, etc.

On top of that, you should integrate a product like Eraser into your application (Eraser is Free software and its source code is released under GNU General Public License).

다른 팁

From what I've read , the solution to actually making the data no longer visible seems to be overwriting the file with 0's and 1's.

If the file you're erasing securely was yours to begin with, you may want to consider encrypting it in the first place. Then even if it is recovered after deletion, information will not be disclosed (assuming you can control the keys).

You could open the file and overwrite it using a stream cipher multiple times. Overwriting it 7 times and then deleting it seems to be the norm :)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top