Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I implemented my own version of an aes-cipher in java to have a platform independent encryption application that is not dependent on the available ciphers in the jvm in use.

This application should use this cipher to encrypt a file and store it on the hard drive.


The problem: Delete files in such a way that they cannot be restored

The user now has to be able to safely delete his original file, so it cannot be restored without knowing the encryption key. In order to do so, the app would have to overwrite the file multiple times with random data and finally delete it from the system.

But Windows for example hinders me with another pitfall to secure the encrypted data. Starting with Windows Server 2003 the Shadow Copy technology is in use. So older Versions of the deleted file can still be hidden away by Windows.

My questions are now:

  • Are there similar technologies in use for Mac or Linux Mint/Ubuntu?
  • Is there some (platform independent) way to delete files with no possibility to restore them?
share|improve this question
Don't cook your own encryption schemes. There are existing ones that have been thoroughly tested and tried; make use of those. – devnull Mar 4 '14 at 17:13
Platform independent: Drill holes through the disk drive, then drop it in a vat of acid. – Daniel R Hicks Mar 4 '14 at 17:15
Related (but not an answer):… – Canadian Luke Mar 4 '14 at 17:24
@devnull: aes 128/196/256 are standardized ciphers. Why on earth should I not implement them? – user1861174 Mar 4 '14 at 17:41
There are many applications that permanently remove data by repeatedly writing random data to that location on the disk. The only case where it doesn't work is on flash devices with wear-management. Unfortunately I don't knowhow they are implemented. – Wutaz Mar 4 '14 at 17:53

The only way to verifiably prevent undeletion of files without sector-level access to the disk and knowledge of the filesystem is to open a file, write random data to it until the disk is full, then delete the file. And if things are being shadowed, this probably doesn't help.

If the user cannot get to the key, then the data in the file is useless, and you might as well not worry about deleting it. If the length of the file could give away information, pad your data before writing.

If you only want a single key to work on encrypting/decrypting that file, then you need to derive unique session keys from an upstream master key.

Note that if you are storing keys, or things that are used to derive keys, in the same place as the ciphertext, you are implementing a fundamentally broken system that can always be cracked eventually.

share|improve this answer

Unfortunately, there is no way to get around this. Various implementations of built on OS software or 3rd part tools are designed to retain data so that it can be recovered. There is nothing you can do within your application that can override this. File versioning, shadow copies, backups, etc will make copies of your file.

The only thing you can do is store the files on a device or volume that has no "backups."

share|improve this answer
but how do you find out, if a device/volume/operating system stores an additional backup – user1861174 Mar 4 '14 at 18:21
you would have to check with your system administrators – Keltari Mar 4 '14 at 18:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .