Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Receiving strange results in emails

Status
Not open for further replies.

MatthewP

Programmer
Jan 16, 2001
176
GB
Hi,

I am using PGP on a unix server, but instead of receiving an encrypted email, I get the following in the body of the message instead, and I can't work out why.
I hope someone can help (my script is listed below too..)
Thanks - Matt.

From body of email where encrypted message should be :

pgpe [[-r <recip1> -r <recip2>] [-s [-u <myid>]] | [-c]] [-afqtvz]
<file1> [-o outfile1] <file2> [-o <outfile2>]
PGP Encrypt file(s)
-a ASCII armoring
-c Conventional Encryption (IDEA only; is mutually exclusive
with -s, -u and -r)
-f Filter Mode; Read from stdin to stdout
-o <output file> Output file for most recent input file
-q Quiet mode
-r <userid> UserID to encrypt to. May be specified multiple times.
-s Sign, as well as encrypt (use pgps to just sign). If no
userid is specified with -u, the default userid is used.
-t Text mode
-u <userid> UserID of the key you wish to sign with. May only be
specified once.
-v Verbose
-z Batch mode (assumes no user interaction; not yet
implemented.
--license Display usage license
Other programs in this suite include pgps to sign, pgpv to decrypt/verify,and pgpk for key management.

#!/usr/bin/perl
use FileHandle;
use IPC::Open2;
#set path
$ENV{'PGPPATH'} = $ENV{'DOCUMENT_ROOT'} . '/../.pgp';
#set mailprog
$mailprog = '/usr/lib/sendmail';
#set recipient
$encryptedRecipient = &quot;me\@mydomain.co.uk&quot;;
#print header
print &quot;Content-type: text/html\n\n&quot;;
print <<HTML;
<html><head><title>sending order...</title></head><body bgcolor='#8E59EF' text='white'>PGP EMAIL TEST PROGRAM
HTML
# Send E-Mail
open(MAIL,&quot;|$mailprog -t&quot;);
$pid = open2(\*Reader, \*Writer, &quot;/usr/local/bin/pgpe -a $encryptedRecipient&quot;);
Writer->autoflush();
print &quot;pid is $pid\n&quot;;
print MAIL &quot;To: $encryptedRecipient\n&quot;;
print MAIL &quot;From: $encryptedRecipient\n&quot;;
print MAIL &quot;Subject: Encryption test\n\n&quot;;
print MAIL &quot;\n Non encrypted text\n&quot;;
print MAIL &quot;-&quot; x 75 . &quot;\n\n&quot;;
print Writer &quot;Should be encrypted text\n\n&quot;;
print MAIL &quot;-&quot; x 75 . &quot;\n\n&quot;;
#close
close Writer;
@got = <Reader>;
print MAIL @got;
close (MAIL);
print &quot;</body></html>\n&quot;;


 
In the line of your script that issues the command to pgpe i think the syntax is wrong, you need the -r flag before the recipient...I think it should be:

$pid = open2(\*Reader, \*Writer, &quot;/usr/local/bin/pgpe -ar $encryptedRecipient&quot;);

Good Luck
--
Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top