Subject: scripts with pgp and pine

From: [email-masked] (Christoph Torlinsky)
Date: 30 Aug 1996 21:24:27 -0700

in the past some people posted sites that had information
  useful to integration between pine and pgp. scripts and
  stuff on some webpage. anyone mind reposting it?

 Thanks

chris

---

From: [email-masked] (Roland Rosenfeld)
Date: 31 Aug 1996 13:13:42 +0200

>   stuff on some webpage. anyone mind reposting it?

Here are the scripts I use:

------------------------ pgpdecode -------------------------------
#!/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.5 1996/08/31 11:10:50 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
# 27.08.96 corrected code for adding new keys

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, "| tee $pgperr 1>&2") || &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(PGPERR, "<$pgperr") || &abort("Can't read $pgperr");

        while (<PGPERR>) {
            print "| $_";
        }
        close(PGPERR);
        unlink $pgperr;

        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
}
------------------------ pgpdecode -------------------------------

------------------------ pgpencrypt ------------------------------
#!/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.???.$$
------------------------ pgpencrypt ------------------------------

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

pgp -fast
------------------------ pgpsign ---------------------------------

These skripts work with pine 3.93, 3.94 and 3.95.
You have to add the following (with correct path!) to your ~/.pinerc:

# 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: Fred Ringel <[email-masked]>
Date: Sat, 31 Aug 1996 21:53:23 GMT

>  stuff on some webpage. anyone mind reposting it?
	Try http://www.rivertown.net/~pgp and the links on integrating
Pine with PGP and the MKPGP program.

	Fred
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Fred B. Ringel				Rivertown.Net
Systems Administrator			P.O. Box 532
and General Fixer-upper			Hastings, New York 10706
Voice/Support: 914.478.2885		Data: 914-478-4988

PGP-Users Mailing list maintainer--http://www.rivertown.net:8080
				AND
Westchester's Rivertown's Full Service Flat-Rate Internet Access Provider 

For my PGP key, send an e-mail with the Subject: SEND-PGPKEY