Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Securely deleting a file in C#.NET

In a project I am doing I want to give users the option of 'securely' deleting a file - as in, overwriting it with random bits or 0's. Is there an easy-ish way of doing this in C#.NET? And how effective would it be?

like image 633
Chris Avatar asked Nov 10 '10 18:11

Chris


1 Answers

You could invoke sysinternals SDelete to do this for you. This uses the defragmentation API to handle all those tricky edge cases.

Using the defragmentation API, SDelete can determine precisely which clusters on a disk are occupied by data belonging to compressed, sparse and encrypted files.

If you want to repackage that logic in a more convenient form, the API is described here.

like image 68
Steve Townsend Avatar answered Sep 18 '22 00:09

Steve Townsend