need example of passing clear text to gpg from another app without using temp files

Luke Powell luke at lukepowell.net
Tue Feb 12 00:57:17 CET 2008


On 02/11/2008 03:30 PM, Dave (My-IOP) wrote:
> Hi,
> I want to pass clear text from a text editor to gpg for encryption (on a 
> Linux system). Currently it is being done by writing the clear text to a 
> temp file and having gpg read that temp file and then write it back out 
> as an encrypted file. Obviously, it would be much better to avoid ever 
> writing the clear text to disk.
> 
> How can I pass the clear text to gpg via a pipe and avoid using the temp 
> file on disk?
> 
> I am a noob (to both Linux and gpg), so a very clear example is greatly 
> appreciated.
> 

Well, it really depends a lot on your text editor. I use Vim, so my 
command is

gg!Ggpg -ae -r luke at lukepowell.net

That goes to the beginning of the file and filters all the text through 
the the process gpg -ae -r luke at lukepowell.net.

As for how to do it under Emacs, I'm sure another of these fine people 
can help. Also, if security is important, you'll want to make sure that 
any hard drive writes or backups are disabled. In Vim, you'll want to 
turn off the scratch file.

Hope that helps,

Luke Powell




More information about the Gnupg-users mailing list