Net Encryption Library
Secure File Erase
Basic Tasks > Secure File Erase

Secure File Erase Overview

The secure file erase will overwrite the file using the selected algorithm, change the file length to zero, change the file date to 1/1/2034, and rename the file to a random file name.  In this way not only the data is overwritten but it will be impossible to see the length, date, or name of the file.

 

Here are the supported secure erase algorithms:

 

C# Copy Code
Encryption encryption = new Encryption(); //Trial Mode
//Encryption encryption = new Encryption("place user name here", "place license key here"); //License Mode
 
string testFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testfile.txt");
File.WriteAllText(testFile, "This is a test");
 
Stopwatch watch = new Stopwatch();
watch.Start();
encryption.SecureFileErase(testFile, SecureEraseAlgorithm.Dod7);
watch.Stop();
Console.WriteLine("Elapsed: " + watch.ElapsedMilliseconds);
 
bool fileExists = File.Exists(testFile);
Console.WriteLine("File Exists: {0}", fileExists);
VB.NET Copy Code
Dim encryption As New Encryption() 'Trial Mode
'Encryption encryption = new Encryption("place user name here", "place license key here"); //License Mode
 
Dim testFile As String = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testfile.txt")
File.WriteAllText(testFile, "This is a test")
 
Dim watch As New Stopwatch()
watch.Start()
encryption.SecureFileErase(testFile, SecureEraseAlgorithm.Dod7)
watch.Stop()
Console.WriteLine("Elapsed: " & watch.ElapsedMilliseconds)
 
Dim fileExists As Boolean = File.Exists(testFile)
Console.WriteLine("File Exists: {0}", fileExists)