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…

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s