Categories
Uncategorized

Quick data pipeline for encryption and decryption

In the need for a quick pipeline to encrypt and decrypt data, gpg can be quite handy, for example it can be used in this way to encrypt  some backup before transferring it to a third part hosted  storage:

cat backupfile.tgz | gpg -c --cipher-algo=BLOWFISH > backupfile.tgz.gpg

(you’ll be asked for the Passphrase to use for encryption)and for decryption:

cat backupfile.tgz.gpg |gpg -d --cipher-algo=BLOWFISH > backupfile.tgz

(you’ll be obviously asked for the Passphrase again, don’t forget it and save it in a safe place!)To use it inside a script (batch process) the useful --passphrase switch can be employed:

cat backupfile.tgz | gpg -c –cipher-algo=BLOWFISH --passphrase abcdefghi1234567890 > backupfile.tgz.gpg

in this case, do not forget to set 700 the file for avoiding unwanted reading…