chrissimpkins / crypto

Simple symmetric GPG file encryption and decryption
http://chrissimpkins.github.io/crypto
MIT License
48 stars 27 forks source link

Delete files after encryption. #14

Open chrisidefix opened 9 years ago

chrisidefix commented 9 years ago

Generally, when you encrypt files, it might make sense to delete the original and only keep the encrypted version (this is probably not the default behaviour the users expect, but a regularly used one).

In this scenario - if you encrypt many files, it may make sense to allow crypto to delete these input files after encryption has finished (e.g. --delete or --remove). Of course the user could also do this manually, but it seems like a sensible option to include into crypto. @chrissimpkins do you think this feature would make sense?

Obviously it would also be important to make sure that the encryption was really successful as discussed in issue #13

And extending that thought - it would really be great to be able to securely delete this file (on users request), but I haven't seen a pythonic way to do this (OS X for example has an Finder option to Secure Empty Trash ..., but I don't think you can call this from Python :laughing:). Any ideas?

chrissimpkins commented 9 years ago

As an option like you suggest, I like this idea. Posted some information below for the development of this feature.

References:

Secure file deletion via Python on SO: http://stackoverflow.com/questions/17455300/python-securely-remove-file

srm:

srm --help
Usage: srm [OPTION]... [FILE]...
Overwrite and remove (unlink) the files.

  -d, --directory     ignored (for compatibility with rm(1))
  -f, --force         ignore nonexistent files, never prompt
  -i, --interactive   prompt before any removal
  -s, --simple        only overwrite with single random pass
  -m, --medium        overwrite with 7 US DoD compliant passes
  -z, --zero          after overwriting, zero blocks used by file
  -n, --nounlink      overwrite file, but do not rename or unlink
  -r, -R, --recursive remove the contents of directories
  -v, --verbose       explain what is being done
      --help          display this help and exit
      --version       display version information and exit

Note: The -s option overrides the -m option, if both are present.
If neither is specified, the 35-pass Gutmann algorithm is used.