Revision 4 not available (showing current revision instead)

Encrypting and decrypting files

Last edit

Changed:

< Don't forget to use a wiping tol (not plain "rm") for the file you just encrypted, otherwise it'll be trivial for an attacker or nosy system administrator to get the original file through undeleting the files.

to

> Don't forget to use a wiping tool (not plain "rm") for the file you just encrypted, otherwise it'll be trivial for an attacker or nosy system administrator to get the original file through undeleting the files.


Create a shellscript called enc with the following line:

  #!/bin/sh
  openssl enc -aes-256-cbc -salt -in $1 -out $1.enc

Then create a shellscript called dec with the following line:

  #!/bin/sh
  openssl enc -d -aes-256-cbc -in $1 -out `basename $1 .enc`

Almost all Linux distributions use the OpenSSH/OpenSSL libraries, so these shellscripts should work universally.

Don't forget to use a wiping tool (not plain "rm") for the file you just encrypted, otherwise it'll be trivial for an attacker or nosy system administrator to get the original file through undeleting the files.

Tip: if you need to encrypt a whole directory, tar and gzip (or bzip2) it first. Compression before encryption is always a good idea.