Using PGP with Pine 3.92 and newer

(Plese note, that I do no longer use Pine myself, so the following scripts are no longer supported. Maybe you should have a look at other scripts for this purpose, which may be still supported by their authors).

Since version 3.92 the pine mailreader allows to use filters for incoming and outgoing mail. This feature can be used to realize a PGP interface for pine.

I wrote three scripts to have a comfortable interface:

  • pgpdecode is used do decrypt PGP signed messages, PGP encoded messages and PGP key blocks. This script reads the PGP message on stdin and writes the decrypted message to stdout. If any user interaction is needed by PGP, the user is asked on stderr. The comments PGP tells you are added to the decrypted message so you are able to quote them.
  • pgpencrypt is used to sign and encrypt your messages.
  • pgpsign is used to sign your message but send it as plain text and not encrypted.

Installing PGPPINE

To use these scripts, simply put them into some directory (I use /home/roland/bin/), start your pine and enter the setup menu (press S for Setup and C for Config in the main menu). Move down in this menu and you will find display-filters and sending-filters. Now you have to add the following new values (press A for each line) to these fields:
display-filters = _BEGINNING("-----BEGIN PGP")_ /home/roland/bin/pgpdecode
sending-filters = /home/roland/bin/pgpsign
                  /home/roland/bin/pgpencrypt _RECIPIENTS_
Use the path, where you installed the scripts instead of /home/roland/bin/ above. Please note, that you have to enter the full pathname of the scripts, otherwise pine won't execute them.

Reading PGP messages

Now pine will start the pgpdecode-filter every time it finds a line beginning with "-----BEGIN PGP" in a mail and decodes it before showing it. Before pgp is run, you are asked whether to run it or to display the encrypted message (this can be usefull, if you have a slow machine and want to read a signed message without checking the signature). If you do not want to be asked every time but run pgp always, then add the option -dontask as an option to pgpdecode in display-filters above.

Writing PGP messages

When you write a message to someone and press Ctrl-X to send it, pine will prompt you Send message (unfiltered)?. At this point you can press Ctrl-P or Ctrl-N and pine will ask you whether you want to send the message filtered through pgpencrypt or pgpsign. Take your coice and the message will be signed and encrypted or only signed. PGP will propmt you for your pass phrase and send the message.

If you tried to encrypt the message and some of the addressiees (To:, Cc:, Bcc:,...) can not be found in you public keyring, pine will return to the mail editing screen and you can change the addresses.

Maybe you want to read the encrypted mails which are stored as Fcc: than it would be a good idea to encrypt it for your own address, too. This can be done by sending yourself a Cc: or Bcc: or by adding adding the option -metoo to pgpencrypt in your pine setup like following:

sending-filters = /home/roland/bin/pgpsign
                  /home/roland/bin/pgpencrypt -metoo _RECIPIENTS_

Getting PGPPINE

You can fetch the above described scripts as a complete packet called pgppine.tar.gz.

Other ways to join PGP and Pine