displaying decrypted plaintext on screen instead of output to file

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 8 22:33:38 CEST 2011


On 09/08/2011 04:21 PM, vedaal at nym.hush.com wrote:
> On Thu, 08 Sep 2011 15:02:32 -0400 Daniel Kahn Gillmor 
> <dkg at fifthhorseman.net> wrote:
>> On 09/08/2011 02:54 PM, vedaal at nym.hush.com wrote:
>>> Is there an option in gnupg like the '-m' option in pgp which 
>>> allows the display of decrypted plaintext on the screen instead 
>> of 
>>> saving to file, 
> 
>> gpg --encrypt --armor -r $recipient
>>
>> (then type your message, and end with a ctrl-D after the last 
>> newline)

> can't get it to work,
> 
> this is what happens (using cygwin on winxp):

it looks like you didn't hit return after the recipient address?
hitting return on just the command i wrote invokes gpg, which will be
waiting for data on its standard input.  Then, you type what you want to
encrypt, hit return, and then ctrl-d to indicate end-of-file.  gpg
realizes its input is done, processes the material, and dumps the
encrypted output to stdout.

Alternately, you could feed your data directly on stdin from the command
line with a pipe, like this:

 printf "just a test" | gpg --encrypt --armor -r $recipient

If you're not down with these patterns, i recommend getting comfortable
with stdin and stdout.  The time spent will be repaid immensely if you
plan to work with UNIX-like systems in the future.  I recommend reading
up on the basics of the concept:

 http://www.linfo.org/standard_input.html
 http://www.linfo.org/standard_output.html
 https://secure.wikimedia.org/wikipedia/en/wiki/Standard_streams

and maybe also searching around on the 'net for some tutorials.  Playing
with pipes and redirection in your favorite shell is probably the best
way to really internalize the concept, of course.

hth,

	--dkg

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1030 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20110908/a5fc59b4/attachment.pgp>


More information about the Gnupg-users mailing list