Subject: Re: PGP & PINE solution

From: [email-masked] (Trey Harris)
Date: 29 Oct 1994 13:32:23 -0400

In article <[email-masked]>,
Michael Lawless <[email-masked]> wrote:
>This was sent to me regarding PGP and Pine.  I set it up as per the directions,
>and it work's like a charm.  I take no credit for this, just reposting it.

Note that this script needs extensive work to run under AIX.  I
haven't yet had a chance to play with it, but simply making the
conversions the author suggests for SysV operating systems is not
sufficient.

When I get a chance I'll try making some changes to it and get it to
work.  But if anyone has scripts that work under AIX, I'd be glad to
receive them.

Trey Harris                              http://sunsite.unc.edu/harris
--Stranger in a Strange Thread!

---

From: [email-masked] (Michael Lawless)
Date: 28 Oct 1994 23:19:31 GMT

>From [email-masked] Oct 28 16:16:09 1994
Date: Wed, 26 Oct 1994 12:32:29 +0000
From: [email-masked]
Reply to: [email-masked]
To: Michael Lawless <[email-masked]>
Newsgroups: comp.mail.pine
Subject: Re: PGP 2.6 and Pine 3.91

-----BEGIN PGP SIGNED MESSAGE-----

In article <[email-masked]> you wrote:
> Would someone please post (or re-post as the case may be) a pine script for using
> PGP?  I think I've seen them before in this group, but on looking back, I can't
> find any.

There are some perl scripts around which you can use, but I find them a
little bulky, so I wrote this shellscript which does the job pretty
well.  It uses the Solaris2 version of 'echo', so if you're on a BSD
system, change any echo lines that end in \c to 'echo -n' and remove the
\c.  There might be a few \t's in the echo lines too.  These need to be
replaced with real tabs for BSD echo.

To integrate it into pine, put this script somewhere in your path (with
read & execute perms on it) and change the alternative editor to
'editpgp -i'.  Write your mail as normal, then enter the alternate
editor to handle signing and encryption.  (Just run 'editpgp' with no
args for info on command line args).  'editpgp -h' should be used with
applications like TIN which leave headers in the text to be edited.

The only bug(/feature?) with this script is that if you reply to
encrypted mail and include the message in the reply, the script doesn't
automatically decrypt the message for you.  I only wrote it because I
didn't like the perl scripts and I was bored, so I don't pretend it's
perfect, but it works pretty well and it's fast *;O)

	Mark.

- --
.--------------------------{ From:  Mark Lewis }--------------------------.
|      PGP public key available by fingering [email-masked]      |
`------------------{ Email:  [email-masked] (MIME) }-------------------'

- ----{ editpgp }----

#!/bin/sh
#
# PGP editor wrapper.
#
# Copyright (c) 1994, Mark Lewis.
#
# This software may be distributed freely as long as no profit is made
# from it and this header remains intact.

tmpdir=/tmp

### Functions

f_test_args()
{
    if [ $# -eq 0 ]; then
	echo "Usage: `basename $0` [-option] filename"
	echo "Options:"
	echo "\t-i\tinteractive (start at the menu)"
	echo "\t-h\theader mode (don't sign or encrypt headers)"
	exit 1
    fi
}

f_split_file()
{
    if [ "$headermode" ]; then
	awk '{ print }; /^$/ { exit }' $filename > ${tmpdir}/tmp$$.hdr
	awk 'body == 1 { print }; /^$/ { body=1 }' $filename > ${tmpdir}/tmp$$
    else
	cp $filename ${tmpdir}/tmp$$
    fi
}

f_restore_file()
{
    if [ "$headermode" ]; then
	cat ${tmpdir}/tmp$$.hdr ${tmpdir}/tmp$$.asc > $filename
	rm -f ${tmpdir}/tmp$$.hdr ${tmpdir}/tmp$$.asc
    else
	mv -f ${tmpdir}/tmp$$.asc $filename
    fi
}

### Start of script

# Parse arguments
while [ 1 ]; do
    if [ "$1" = "-" ]; then
	shift
	break
    elif [ "$1" = "-i" ]; then
	shift
	ans=interactive
    elif [ "$1" = "-h" ]; then
	shift
	headermode=1
    else
	break
    fi
done

f_test_args $*
clear
defeditor=${EDITOR:-${VISUAL:-vi}}
filename=`echo "$*" | cut -d' ' -f$#`

if [ "$ans" != interactive ]; then
    echo "$defeditor $*"
    $defeditor $*
fi

# Interactive part
while [ "$ans" != x ]; do

    echo "\n[E]dit/view, en[C]rypt, clear[S]ign or e[X]it? \c"
    read ans

    if [ "$ans" = e ]; then

	echo "Which Editor/Viewer? [${defeditor}] \c"
	read editor
	echo "${editor:-$defeditor} $*"
	${editor:-$defeditor} $*

    elif [ "$ans" = c ]; then

	recipients="?"
	while [ "$recipients" = "?" ]; do
	    echo "Enter recipients, separated by spaces: ('?' to list keys)"
	    read recipients
	    if [ "$recipients" = "?" ]; then
		pgp -kv
	    elif [ "$recipients" = "" ]; then
		echo "Encryption aborted."
	    else
		while [ "$opts" = "" ]; do
		    echo "Sign encrypted message (y/n)? [n] \c"
		    read tmp
		    if [ "$tmp" = y ]; then
			opts=seat
		    elif [ "$tmp" = "" -o "$tmp" = n ]; then
			opts=eat
		    fi
		done
		f_split_file
		pgp -$opts ${tmpdir}/tmp$$ $recipients
		rm -f ${tmpdir}/tmp$$
		if [ $? -eq 0 ]; then
		    f_restore_file
		else
		    echo "*Error in encryption. Aborted."
		fi
	    fi
	done

    elif [ "$ans" = s ]; then

	f_split_file
	pgp -sat +clearsig=on ${tmpdir}/tmp$$
	rm -f ${tmpdir}/tmp$$
	if [ $? -eq 0 ]; then
	    f_restore_file
	else
	    echo "*Error in signing. Aborted."
	fi

    fi

done

clear
exit 0

-- 
---------------------------------------------------------------
Michael Lawless       		|Remote Sensing Research Unit
[email-masked]		|Geography Department, UCSB
				|Santa Barbara CA, 93106
---------------------------------------------------------------

---

From: [email-masked] (Matthew Wilcox)
Date: Sun, 30 Oct 1994 15:36:46 +0000 (GMT)

Trey Harris ([email-masked]) wrote:
: In article <[email-masked]>,
: Michael Lawless <[email-masked]> wrote:
: >This was sent to me regarding PGP and Pine.  I set it up as per the directions,
: >and it work's like a charm.  I take no credit for this, just reposting it.

Where did you repost it?  I'm sorry, I'm new to this newsgroup and I've seen
your earlier requests for something that will let PGP & Pine work together
but seem to have missed your repost of the script.  Any chance of rereposting
it?

Matthew

--
+=======================================================================+
| If the early bird catches the worm |				       /|
| why does the worm bother getting   |	Disclaimer :		      / |
| up in the mornings? - R Heinlein   |	I don't think the University /--|	
| Matthew Wilcox <[email-masked]> |	care about my opinions	    /   |
+=======================================================================+

---

From: Matthew Osborne <[email-masked]>
Date: Sun, 30 Oct 1994 11:43:40 -0600

> but seem to have missed your repost of the script.  Any chance of rereposting
Yes, I would also me very thankfull if you could repost it or email it 
too me. 
thanks!!
--
==============================================================================
= Matt  O s b o r n e (gama)=   =  "Practise safe TeX, use LaTeX"-unknown    =
=  [email-masked]  =      send flames to /dev/null              = 
==============================================================================