Sometimes I don’t simply want to encrypt files, I need to encrypt plain text only, e.g. to send it in the body of an email. I’m using PGP (Pretty Good Privacy) because it’s widely used and it can be installed on Linux, Windows and OSX machines. Well, on *nix machines the program is called GPG (Gnu Privacy Guard) but it’s the only difference. Furthermore, instead of creating To encrypt file content (not the file itself!) use this bash one-line commands:
cat PLAINFILE | gpg -a -o - -r RECIPIENT -e -
It will dump the encrypted content, additionally with ascii armature (option -a
or --armor
), to stdout (option -o -
); therefore no data, altough encrypted, will be ever written on disk. Use this bash one-line command to decrypt pgp’ed data to stdout rather than a file.