Subject: PINE and PGP ?

From: tkn@wigeo2. (Thomas Netousek)
Date: 12 Nov 1994 13:01:13 GMT

What is the best way to send and receive pgp encrypted messages with
pine-3.91 ?

Thomas Netousek

---

From: [email-masked] (Michael Lawless)
Date: 14 Nov 1994 00:51:43 GMT

This is what I got when I asked that question.  It works for me.

------Begin Forward--------
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

------- End Forward ---------

-- 
---------------------------------------------------------------
Michael Lawless       		|Remote Sensing Research Unit
[email-masked]		|Geography Department, UCSB
"I dream in infra-red."         |Santa Barbara, CA 93106          
---------------------------------------------------------------

---

From: [email-masked] (J. Kelly Cunningham)
Date: 14 Nov 94 13:56:35 CST

In article <[email-masked]>,
>What is the best way to send and receive pgp encrypted messages with

Why, mkpgp of course!  @;o)  

-- kc    finger [email-masked] | pgp -fka +force
         finger [email-masked] | pgp -f > mkpgp.txt.uu