How to add PGP 2.6.3 support for Pine

How to add PGP 2.6.3 support for Pine

NOTE: I now use this package instead of this method: PinePGP.

(Last updated 10/22/2001)

I am sure there are better methods, but this is what works for me.

  1. Get Pine 3.96 through 4.30 (comes with most linux distributions).
  2. Get PGP 2.6.3:
  3. Get PGP working.
  4. Create a 'bin' directory under your home directory like this: mkdir ~/bin
  5. Make the following symbolic links:
  6. Execute the following commands:
  7. Open up ~bin/pgp-view with your favorite text-editor and put this inside of it:
    #!/bin/bash
    # This script can be changed to your preferences...
    umask 077
    TEMPFILE=/tmp/kirk.pgp.$$
    rm -rf $TEMPFILE 2>/dev/null
    touch $TEMPFILE
    chmod 0600 $TEMPFILE
    echo "Enter PGP Passphrase:" >&2
    SIG=`cat | /usr/bin/pgp -f 2>&1 > $TEMPFILE | grep "signature" | grep -v "has signature"`
    if [ -z "$SIG" ] ; then
       echo
    else
       echo '****************************************************'
       echo $SIG
       echo '****************************************************'
       echo
    fi
    cat $TEMPFILE
    # NOTE: It is best to install and use wipe instead of "rm"
    #wipe -f $TEMPFILE >/dev/null 2>&1
    rm -f $TEMPFILE
    exit 0
    
  8. Now, to set up Pine, edit ~/.pinerc by hand and find these two variables (which will probably be blank) and change them to this (make sure to fill in your home-directory wherever necessary):
    
    # This variable takes a list of programs that message text is piped into
    # after MIME decoding, prior to display.
    display-filters=_LEADING("-----BEGIN PGP")_ /home/USERNAME/bin/pgp-view
    
    # This defines a program that message text is piped into before MIME
    # encoding, prior to sending
    sending-filters=/home/USERNAME/bin/pgp-sign -fast,
       /home/USERNAME/bin/pgp-encrypt -feast _RECIPIENTS_,
       /home/USERNAME/bin/pgp-encrypt-any -feast,
       /home/kirk/bin/pgp-encrypt-no-sign -feat _RECIPIENTS_
    
    

    (NOTE: You might want to list your own name after the _RECIPIENTS_ lines if you want to be able to read the emails you have sent from your "sent-mail" folder.


How to use PGP inside Pine

To Read Encrypted Mail

Just view it as normal. PGP will ask for your passphrase, then display the message. If you mess up your passphrase, just hit enter and start over. You will not be re-prompted. If the message was signed, you can see if it was a valid signature or not by looking at the top of the message.

To verify signature

Just view it as normal. It will ask for your passphrase, but it will disappear before you can type it in (which is okay!). Look for a message at the top saying whether or not the signature is valid.

To send PGP email

After you hit CTRL-X, you can select a filter. You can sign, encrypt (and sign), or encrypt-to-any. Encrypt tries to match the recipient's name by the email address you used in Pine. Encrypt-To-Any will allow you to specify the recipient directly to the PGP program.


How to get PGP working

To generate your key: pgp -kg

To generate a text version of your public key (to give out to others): pgp -kxa yourname

To add somebody's public key to your keyring, first get their public key into a text-file, then: pgp -ka filename


For questions or comments: Kirk Bauer

Return to Kirk Bauer's Homepage