encrypt data, not file, in one line?

slashlars slashlars at ecentricarts.com
Sat Jun 11 00:22:45 CEST 2005


I want to invoke GnuPG on a Windows 2000 server from within a web application.

Problem: I don't want to write temporary plaintext files. 

Encrypting a file is no problem: I do something like:

gpg -o cipher.txt.asc -a -r slashlars at ecentricarts.com --batch --encrypt plain.txt

My web app can retrieve a result from stdout, so I don't need the output file:

gpg -a -r slashlars at ecentricarts.com --batch --encrypt plain.txt

But I can't figure out how to encrypt data from stdin, except interactively at the Windows command prompt, typing or pasting it in and ending with ctrl-C.

I had hoped to find an option like --encrypt-data which would cause the arg after --encrypt to be treated as plaintext data instead of a filename. 
i.e.
gpg -a -r -r slashlars at ecentricarts.com --batch --encrypt-data --encrypt Your secret word is 'dog'

Is there a way to get that to work, either a set of gpg options or in the way I call it on a command line?

The manuals, man page, Google search and a scan of the archives here in gnupg-users has not turned up anything for me.

My (very limited) Windows shell knowledge (plus searches online) doesn't tell me how to pipe data in, except that I can direct a file into stdin -- but of course, I don't want to write the plaintext into a file in the first place!


 -- Lars
.........................................
"If they ever come up with a swashbuckling
 school, I think one of the courses should
 be Laughing, Then Jumping Off Something."
 -- Jack Handey






More information about the Gnupg-users mailing list