Subject: Using Pine 3.94 with PGP

From: "Kevin S. Ford" <[email-masked]>
Date: Mon, 24 Jun 1996 14:50:21 GMT

Well, I've recently built pine 3.94 and understand from my reading that
since pine 3.92, it has been possible to use pine with pgp as a mail
filter for smoothly handling encryption and decryption of email sent and
received.

I've read the help under the Setup-Config option:

sending-filters
display-filters

and it is of some assistance.  I also looked at the release notes of pine
3.94 for any mention of pgp (only once and offers little help).

So far I've tried setting /usr/local/bin/pgp -seat
as my sending filter, and when I use C-X to send, it does invoke PGP, asks
for my pass-phrase to sign the message, and asks for the recipient's user
id.  I've also put /usr/local/bin/pgp as my display filter.

What I've tried so far is sending myself mail encrypted with my public key
in the above manner, and when I receive the mail, the body is empty (and
it was not when I sent).   I would have guessed that the display filter
would do something smart like notice that this was encrypted, ask for the
pass-phrase of the secret key required to decrypt, but I get no such
thing.

Can anyone offer some hints or maybe a good document to read for how to
set up pine 3.94 with pgp to do the typical things?  Advice would be much
appreciated.

Thanks in advance

___________________________________________________________________________
 Plan ahead.  Promote swift colonization of the solar system...  *First* 
____________________________________________
__________________

When more and more people are thrown out of work, unemployment
results.
		-- Calvin Coolidge

_______________________
____________Kevin S Ford__________
[email-masked]

---

From: [email-masked] (Roland Rosenfeld)
Date: 25 Jun 1996 11:09:05 +0200

[F'up-To: comp.mail.pine]

Kevin S. Ford <[email-masked]> wrote:

> Can anyone offer some hints or maybe a good document to read for how
> to set up pine 3.94 with pgp to do the typical things?  Advice would
> be much appreciated.

I wrote three skripts for this, which work very well here.  Maybe you
will find them usefull.

pgpsign:
----------------------------- schnipp -----------------------------
#!/bin/sh
#
# 21.03.96 Roland Rosenfeld <[email-masked]> 
#

pgp -fast
----------------------------- schnipp -----------------------------

pgpencrypt:
----------------------------- schnipp -----------------------------
#!/bin/sh
# 
# $Id: pgpencrypt,v 1.6 1996/06/25 09:05:28 roland Exp $
#
# 21.03.96 Roland Rosenfeld <[email-masked]> 
# 17.05.96 exit added.
# 

umask 077
TMPFILE="/tmp/pgpencrypt"
trap "rm -f $TMPFILE.???.$$; exit 1" 1 2 15

(pgp +verbose=1 -feast $* >$TMPFILE.txt.$$) 2>&1 | tee $TMPFILE.pgp.$$ 1>&2

if grep '/pubring.pgp' $TMPFILE.pgp.$$ >/dev/null
then 
        rm -f $TMPFILE.???.$$
        exit 1
fi

cat $TMPFILE.txt.$$
rm -f $TMPFILE.???.$$
----------------------------- schnipp -----------------------------

pgpdecode:
----------------------------- schnipp -----------------------------
#!/usr/local/bin/perl
#
# filter for pine 3.93 and newer for decoding pgp mails
# use this with the following in your .pinerc:
# display-filters=_BEGINNING("-----BEGIN PGP")_ /home/roland/bin/pgpdecode
#
# $Id: pgpdecode,v 1.4 1996/05/23 17:59:20 roland Exp $
#
# 21.03.96 Roland Rosenfeld <[email-masked]> 
# 23.03.96 $TMPFILE moved to $PGPPATH.
# 17.05.96 total rewrite in perl; many new features

umask 077;

$tmpdir = $ENV{'PGPPATH'};     # this offers more security than /tmp 
$pgpout = "$tmpdir/pgpout$$";
$pgperr = "$tmpdir/pgperr$$";

$pgpfound=1;

while ($pgpfound) {

    while (($_=<>) && !(/^-----BEGIN PGP/)) {
        print $_;
    }
    if (/^-----BEGIN PGP/) {
        $pgpfound=1;
    } else {
        $pgpfound=0;
    }
    
    if (/^-----BEGIN PGP PUBLIC KEY BLOCK-----$/) {
        $pgpkeyblock .= $_;
        while (($_=<>) && !(/^-----END PGP PUBLIC KEY BLOCK-----$/)) {
            $pgpkeyblock .= $_;
        }
        $pgpkeyblock .= $_;
        
        open(SAVEOUT, ">&STDOUT");
        open(SAVEERR, ">&STDERR");
        open(STDOUT, ">$pgpout") || &abort("Can't redirect stdout");
        open(STDERR, ">&STDOUT") || &abort("Can't redirect stderr");
        open(PGP, "|pgp -kaf") || &abort("Can't execute pgp");
        print PGP $pgpkeyblock;
        close(PGP);
        close(STDOUT);
        close(STDERR);
        open(STDOUT, ">&SAVEOUT");
        open(STDERR, ">&SAVEERR");
        
        open(PGPOUT, "<$pgpout") || &abort("Can't read $pgpout");
        while (<PGPOUT>) {
            print "| $_";
        }
        close(PGPOUT);
        unlink $pgpout;
    } elsif (/^-----BEGIN PGP( SIGNED)? MESSAGE-----$/) {
        $pgpmessage .= $_;
        $pgpheader = $_;

        while (($_=<>) && !(/^-----END PGP (MESSAGE|SIGNATURE)-----$/)) {
            $pgpmessage .= $_;
        }
        $pgpmessage .= $_;
        
        open(SAVEOUT, ">&STDOUT");
        open(SAVEERR, ">&STDERR");
        open(STDOUT, ">$pgpout") || &abort("Can't redirect stdout");
        open(STDERR, "| tee $pgperr 1>&2") || &abort("Can't redirect stderr");
        open(PGP, "|pgp -f") || &abort("Can't execute pgp");
        print PGP $pgpmessage;
        close(PGP);
        close(STDOUT);
        close(STDERR);
        open(STDOUT, ">&SAVEOUT");
        open(STDERR, ">&SAVEERR");
        
        open(PGPERR, "<$pgperr") || &abort("Can't read $pgperr");
        while (<PGPERR>) {
            print "| $_";
        }
        close(PGPERR);
        unlink $pgperr;

        print "|\n| $pgpheader|\n";

        open(PGPOUT, "<$pgpout") || &abort("Can't read $pgpout");
        while (<PGPOUT>) {
            print $_;
        }
        close(PGPOUT);
        unlink $pgpout;
        
        $pgpheader =~ s/BEGIN/END/;
        print "\n|\n| $pgpheader|\n\n";
    }
}

exit;

sub abort {
    local ($message) = @_;
    unlink $pgpout;
    unlink $pgperr;
    die $message
}
----------------------------- schnipp -----------------------------

These scripts are uses in ~/.pinerc like following:

# This variable takes a list of programs that message text is piped into
# after MIME decoding, prior to display.
display-filters=_BEGINNING("-----BEGIN PGP")_ /home/roland/bin/pgpdecode

# This defines a program that message text is piped into before MIME
# encoding, prior to sending
sending-filters=/home/roland/bin/pgpsign,
        /home/roland/bin/pgpencrypt _RECIPIENTS_

Ciao

        Roland

-- 
  * Internet: [email-masked] * Fido: 2:2450/111.13 *

---

From: [email-masked] (Jie Yuan)
Date: 25 Jun 1996 20:43:05 GMT

In article <[email-masked]>,
>set up pine 3.94 with pgp to do the typical things?  Advice would be much

This is a (undocumented) FAQ and it pops up very often in this group.

I have a web page that describes a procedure to configure Pine to use
PGP for encrypt/decrypt/clear-sign.  The URL is 

	http://www.pharm.med.uc.edu/~yuan/pine_pgp.html

Please take time to visit and comment.

You might have read the followup by R. Rosenfeld.  My approach is much 
simpler than his.  No Perl.  Just Pine, PGP, and csh or ksh.

Jie
-- Jie Yuan, PhD - U. Cincinnati - Pharmacology & C.B. --
== POBox 670575, Cin., OH 45267-0575  =  513-558-2352  ==
== [email-masked] = www.uc.edu/~yuanj =  using Knews  ==
== finger -l [email-masked] for my PGP pub. key=