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


 _______                   _______    _ _
(_______)        _     _  (_______)  | (_)  _
 _  _  _ _   _ _| |_ _| |_ _____   __| |_ _| |_
| ||_|| | | | (_   _|_   _)  ___) / _  | (_   _)
| |   | | |_| | | |_  | |_| |____( (_| | | | |_
|_|   |_|____/   \__)  \__)_______)____|_|  \__)

Hi!

I have developed MuttEdit.ksh v1.0.  It is in the
attachment of this message.

With MuttEdit you'll be able to send PGP unMIMEd
messages, and also configure your .muttrc for sending
PGP unMIMEd messages by default to some email address,
using send-hook.

This message has been PGP unMIMEd clearsigned with
MuttEdit as example.

Check this out!  :-)

- -- 
                               ___      
Daniel González Gasull       __|_|__    "Un sólo muerto es
mailto:[EMAIL PROTECTED]         (o o)     ya demasiado."
PGP RSA key 1024/EEA93A69     ( - )     -- Nelson Mandela
                             (  .  )    
                            (   .   )   
                           (_________)  
> Hi!  I'm Signature Virus 99!  Copy me into your signature and join the fun!


-----BEGIN PGP SIGNATURE-----
Version: 2.6.3in
Charset: latin1
Comment: Get my PGP key: http://gasull.home.ml.org/gasullkey.asc

iQCVAgUBNqWz2MnE0dnuqTppAQFNeAP5AdGSsgudzytXcmyiQmwD2EyhVFUEX++8
BeILrg+PkVNJA7gAx/ameNoXWjmXjlkDzgRKTVdx0ahHaU/DFBnw4uHMqZ+LirxT
N+CmDnOreHdzeDvLWpiaRwjPPP3S1GmXT+smWI0FewLOk24Gcu/QIAYXjr+EzN5K
mSLu8g3Izzk=
=luGD
-----END PGP SIGNATURE-----

#!/bin/ksh
#  _______                   _______    _ _
# (_______)        _     _  (_______)  | (_)  _
#  _  _  _ _   _ _| |_ _| |_ _____   __| |_ _| |_
# | ||_|| | | | (_   _|_   _)  ___) / _  | (_   _)
# | |   | | |_| | | |_  | |_| |____( (_| | | | |_
# |_|   |_|____/   \__)  \__)_______)____|_|  \__)
#
# MuttEdit.ksh v1.0
# For sending unMIMEd PGP messages with Mutt.
# Autor: Daniel González Gasull <[EMAIL PROTECTED]>
#        http://gasull.home.ml.org
#        PGP RSA key 1024/EEA93A69
###

set -u
umask 077

### COPYING: GPL

### REQUIRED:
# /bin/ksh
# Mutt
# formail
# PGP 2.x
###

### INSTALL:
# Put muttedit.ksh in your $PATH.
#       $ chmod 700 muttedit.ksh
# Put in your .muttrc the 3 following UNCOMMENTED lines:
#       set editor="muttedit.ksh|"
#       set set edit_headers
#       send-hook . my_hdr PGP: Clear
# Put here the real editor you like to use:
real_edit="/usr/bin/joe -asis -force -marking -pg 1 -rmargin 55 -wordwrap"
# If you wanna add a comment to your ASCII armor:
comment="Get my PGP key: http://gasull.home.ml.org/gasullkey.asc"
# EncryptToSelf is ON by default:
encrypttoself="on"
###

### USAGE:
# Hi cipherpunks! 
# With muttedit you can choose whether or not MIME or unMIME sign and/or
# encrypt the message from the menu after you edit the message, or inside
# the editor in the PGP: header:
#
#       PGP: Clear      ->      Nothing.  Plain message.
#       PGP: s          ->      PGP/MIME sign
#       PGP: e          ->      PGP/MIME encrypt
#       PGP: es         ->      both (PGP/MIME encrypt and sign)
#       PGP: us         ->      PGP unMIMEd clearsign
#       PGP: ue         ->      PGP unMIMEd encrypt
#       PGP: ues        ->      both (PGP unMIMEd encrypt and clearsign)
#
# Now you can configure your .muttrc with, e.g.:
#       send-hook . my_hdr PGP: Clear
#       send-hook '~t [EMAIL PROTECTED]' "my_hdr PGP: ues"
###

### FAQ:
# Q: Why MuttEdit?  Mutt already has PGP managment. 
# A: Yep.  But it is PGP/MIME managment.  In some situations it is necesary
#    to send PGP unMIMEd messages.  E.g.:
#
#       1) You have a friend that do not handle PGP/MIME messages, but s/he
#          can manage PGP unMIMEd messages with his/her software.
#       2) You use a SMTP of a freemail service, like NetAddress, that
#          modifies the body of the message adding a few lines of
#          advertising at the end.  Then, PGP/MIME signed messages will be
#          modified, and when somebody try verify the digital signature, it
#          will fail. 
#       3) You use a forward email (permanent email address) service
#          that also modifies the body of the message.  Again, nobody will
#          be able to verify your signature on PGP/MIME signed messages.
#       4) You send messages to a mailing list that also modifies the body
#          of the messages for adding ads or whith (un)subscribing info
#          (E.g. debian-user-spanish mailing list).
#
# Q: Must I use MuttEdit for sending PGP unMIMEd messages by default?
# A: PGP/MIME is a very good idea.  It is a standard, unlike PGP unMIMEd
#    messages.  I suggest to send PGP/unMIMEd messages only if you can't
#    send PGP/MIME for any reason.
#
# Q: And how can I read PGP unMIMEd messages with Mutt? 
# A: Using procmail to convert them to PGP/MIME.  See PGP-Notes.txt that
#    comes with Mutt.
###

### BUGS:
# 1) If you edit only the body of the message, muttedit will run and show
#       you the menu, but the options 's', 'e' and 'b' will not work
#       properly, and will modify the body.  Also options 'us', 'ue' and
#       'ub' may fail if the first lines of the body seem headers.
# 2) muttedit only uses the default PGP user ID.
# 3) muttedit do NOT take the recipient(s) user(s) ID(s) from the message.
#       Does anybody know/gnow how to do this?  If you do, please email me
#       to [EMAIL PROTECTED]
# 4) muttedit only works with PGP 2.x.
###

mime_sign ()
{
  formail -f -I "PGP: S" < $1 > $1-muttedit
  mv --force $1-muttedit $1
}

mime_encrypt ()
{
  formail -f -I "PGP: E" < $1 > $1-muttedit
  mv --force $1-muttedit $1
}

mime_both ()
{
  formail -f -I "PGP: ES" < $1 > $1-muttedit
  mv --force $1-muttedit $1
}

unmime_clearsign ()
{
  (formail -f -X "" < $1 ; formail -I "" < $1 | pgp -staf \
        +ClearSig=on +Verbose=0 +Comment="$comment") > $1-muttedit
  # Remove the PGP: header.  Mutt can't understand it.
  formail -f -I PGP: < $1-muttedit > $1
}

unmime_encrypt ()
{
  formail -X To: -X Cc: < $1
  (formail -f -X "" < $1 ; formail -I "" < $1 | pgp -etaf \
        +ClearSig=on +Verbose=0 +Comment="$comment" +EncryptToSelf=on) \
        > $1-muttedit
  # Remove the PGP: header.  Mutt can't understand it.
  formail -f -I PGP: < $1-muttedit > $1
}

unmime_both ()
{
  formail -X To: -X Cc: < $1
  (formail -f -X "" < $1 ; formail -I "" < $1 | pgp -estaf \
        +ClearSig=on +Verbose=0 +Comment="$comment" \
        +EncryptToSelf="$encrypttoself") > $1-muttedit
  # Remove the PGP: header.  Mutt can't understand it.
  formail -f -I PGP: < $1-muttedit > $1
}

menu ()
{
  cat << EOF
Choose an option or press [ENTER] to forget it:

        s       PGP/MIME sign
        e       PGP/MIME encrypt
        es      both (PGP/MIME encrypt and sign)

        us      PGP unMIMEd clearsign
        ue      PGP unMIMEd encrypt
        ues     both (PGP unMIMEd encrypt and clearsign)
EOF
  read option < /dev/stdin
  case $option in
    s) mime_sign $1 ;;
    e) mime_encrypt $1 ;;
    es) mime_both $1 ;;
    us) unmime_clearsign $1 ;;
    ue) unmime_encrypt $1 ;;
    ues) unmime_both $1 ;;
    *) ;;
  esac
}

$real_edit $1
# Read the PGP: header:
pgp_hdr="`formail -x PGP: < $1`"
case $pgp_hdr in
  " s") mime_sign $1 ;;
  " e") mime_encrypt $1 ;;
  " es") mime_both $1 ;;
  " us") unmime_clearsign $1 ;;
  " ue") unmime_encrypt $1 ;;
  " ues") unmime_both $1 ;;
  *) menu $1 ;;
esac

Reply via email to