passphrase-fd $msg & $pass from command line?

Hack Hawk hh@hackhawk.net
Tue Mar 4 04:57:02 2003


Now I feel stupid.  The moment I give up, I find my answer.  Seems to 
always work this way.  Thanks to Paul Evad (May 2000) from the archives, 
slightly altered.  I must've typo'd the first time I tried this because now 
it's working.  :)

$command="echo '$passphrase\n$msg' | gpg --clearsign --passphrase-fd 0"

- hawk

>Date: Mon, 03 Mar 2003 19:39:06 -0800
>To: gnupg-users@gnupg.org
>From: Hack Hawk <hh@hackhawk.net>
>Subject: passphrase-fd $msg & $pass from command line?
>
>Hello,
>
>Please forgive me for discussing a topic already discussed in the 
>archives, but I can't seem to find the "very specific" answer I'm looking for.
>
>I'm writing a PHP script to --clearsign a message.
>
>1) I've found out how to clearsign text passed on the command line.
>   $msg = "my message";
>   $cmd = "echo '$msg' | gpg --clearsign --passphrase-fd 2 2<pass.txt";
>   exec($cmd,$encr,$err);
>
>2) I've found out how to clearsign a file, with the password sent on the 
>command line.  Not sure if the syntax is exactly correct cause I already 
>overwrote this one.
>   $cmd = "echo PASS | gpg --clearsign --passphrase-fd 0 msg.txt";
>   exec($cmd,$outp,$err);
>
>But what I'm failing to find is a way to pass BOTH the message AND the 
>password on the command line without using any files at all.  Is this even 
>possible, or am I just dreaming?
>
>Best Regards
>- hawk