Encrypting STDIN using GnuPG
You want to encrypt a string using GnuPG, but you don't want to leave traces of it in your shell's history.
There's a simple solution: by default, if you don't pass an input file, GnuPG will encrypt STDIN
.
gnupg --encrypt -o encrypted-file.gpg -r <RECIPIENT>
At this point you can type in the string that you want to encrypt, followed by a newline
, after which you have to send an End of Transmission character, a.k.a. CTRL-D
.
And that's it, you now have your encrypted string in encrypted-file.gpg
.
Written by Lorenzo Manacorda
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#