質問

I am wanting to securely wipe a file - of any type or format - obviously the File.Delete command in C# is no where near safe enough.

I seem to recall a post here (I can't find it again though!) that explained the modern File Systems (i.e newer than FAT32) can cause issues when attempting this kind of delete as they're a journaling file system and recovering data is far easier than in ye olden days.

After even more reading, I read it would be an idea to:

  1. Generate a random 256 bit encryption key.
  2. Encrypt FileA to FileB.
  3. Generate a new random 256 bit encryption key.
  4. Encrypt FileB to FileA.
  5. Repeat this n number of times to suit your level of paranoia.
  6. Use File.Delete to delete FileA and FileB.

This seems a logical way for encrypting/re-encrypting the data in the files over and over with keys that will never ever be recoverable or re-usable but is this actually a secure way? Will the file system overwrite the file at the same location/cluster (obviously the file will grow as it's contents are subject to encryption/re-encryption), ensuring the original content is overwritten?

役に立ちましたか?

解決

Your approach won't necessarily solve your problem, and the problem doesn't only exist for journaling filesystems. (The old DOS undelete tool demonstrates that.)

Modern filesystems may move files around at any time, transparently to programs that are currently running, so juggling file content around doesn't guarantee that you won't be leaving an old copy of the file in a section of the disk that's marked unused.

You'd be better off using encryption directly rather than trusting that you can fool the OS into overwriting the old data.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top