Webscript Problems....Converting from PGP to GPG

Neil Williams linux@codehelp.co.uk
Tue Jul 8 20:52:03 2003

Content-Type: text/plain;
Content-Transfer-Encoding: quoted-printable
Content-Description: signed data
Content-Disposition: inline

On Tuesday 08 Jul 2003 5:09 am, Todd G. Hewett wrote:
> Howdy Folks,
> I am trying to get  a perlscript  working using GPG as  opposed to the
> PGP50i  it is currently working with.
> ###
> The PGP Command is...
> (/usr/local/bin/pgpe -fatr name@isp.com +force=3D1 2>/dev/null) |
> /usr/bin/mail -s 'Title of subject line' name@isp.com
> The GPG command I thought would work is.
> (/usr/bin/gpg -fatr 'name@isp.com' +force=3D1 2>/dev/null) | /bin/mail -s
> 'Title of subject line'
>  name@isp.com

What's the +force all about?=20

Gpg is NOT a port of PGP - the same commands cannot be relied upon to perfo=
the same functions or even exist at all in one compared to the other.

> ###
> The following  command line input sends an email fine.
> echo 'check this out' | (gpg -ater 'name@isp.com' 2>/dev/null) |
> /bin/mail -s ''Title of subject line' name@isp.com
> ###
> And this command line sends an empty message
> echo 'check this out' | (gpg -fatr 'name@isp.com' 2>/dev/null) |
> /bin/mail -s 'Title of subject line' name@isp.com

gpg would normally look for a file to encrypt

To get the output to understand what is happening, just ditch the 2>dev/nul=
and this should appear:

gpg: can't open check this out: No such file or directory
gpg: check this out: encryption failed: file open error

In a Perl script I use:

echo "$msg" | gpg -a --always-trust $homedir --batch -r $keyid -e 2>&1
$msg is a variable containing the message
I use --always-trust only because this is a remote application that already=
uses user authentication.
$keyid is another variable holding the verified keyid of the recipient.

> I am hoping there is something obvious that someone can help me with here.

I can't see an option gpg -f in man gpg.
Other than that, you need to redirect stderr to stdout (2>&1 ) in order to =
the encrypted output.


Neil Williams


Content-Type: application/pgp-signature
Content-Description: signature

Version: GnuPG v1.2.1 (GNU/Linux)