Vile macros to PGP-sign buffers

Vile macros to PGP-sign buffers

Post by Clark Morg » Thu, 16 Jan 1997 04:00:00



See comments below.  Enjoy.

Note:  my ISP's newsfeed drops ~50% of USENET articles.  If you
have feedback/comments, send to me via e-mail.

====================== Cut here =======================

; Included below are 4 vile macros to sign buffers with PGP 2.6.2 plain
; text signatures.  One use for these macros is to sign e-mail messages
; or USENET postings.  When selecting one or more of the macros below,
; choose based on these criteria:
;   - type of shell specified in $SHELL
;   - whether or not the buffer contains message headers (at top of
;     buffer) that are separated from message body by a blank line.  
;     Some mail user agents expose headers to the end user (e.g., mush)
;     and others do not (elm).  If you post USENET messages via Pnews,
;     message headers are included in the buffer.
;
; All macros use the same principle:
;   - prompts for PGP pass phrase for user Clark (change this user id
;     as appropriate for your application)
;   - places pass phrase at appropriate point in buffer
;   - filters buffer to pgp and forces pgp to read passphrase from buffer.

; Buffer signed from the first blank line of the buffer to end-of-file.  
; Macro applicable to Bourne shell and derivatives (ksh, bash, etc).  
; Macro elides all pgp stderr output and so if something goes wrong
; (e.g., passphrase typo), you get to figure out what happened.  Look at
; csh-based macros below for a (slower) method that leaves error messages
; in the buffer if pgp fails.
19 store-macro

    write-message " "  ; erase passphrase
    set-variable %var "PGPPASSFD=0; export PGPPASSFD;"
    set-variable %cmd &cat %var "pgp -fsta -u Clark 2>/dev/null"
    beginning-of-file
    search-forward "^[ \t]*$"
    ~force down-line
    insert-string %phrase
    ~force up-line-at-bol
    filter-til end-of-file %cmd
~endm
bind-key execute-macro-19 #-s   ; invoke with the keystroke #s

;
; Same macro as above, except that the entire buffer is signed.
;
20 store-macro

    write-message " "  ; erase passphrase
    set-variable %var "PGPPASSFD=0; export PGPPASSFD;"
    set-variable %cmd &cat %var "pgp -fsta -u Clark 2>/dev/null"
    beginning-of-file
    insert-string %phrase
    ~force up-line-at-bol
    filter-til end-of-file %cmd
~endm
bind-key execute-macro-20 #-S   ; invoke with the keystroke #S

; Buffer signed from the first blank line of the buffer to end-of-file.  
; Macro applicable to csh and its derivatives (tcsh, etc).  Due to
; inherent limitations in csh commandline syntax, this macro reads all
; pgp output (stdout & stderr) and then filters it.  Consequently, if
; something goes wrong (e.g., passphrase typo), the pgp error msg is
; retained in the buffer.
21 store-macro

    write-message " "  ; erase passphrase
    set-variable %var "setenv PGPPASSFD 0;"
    set-variable %cmd &cat %var "pgp -fsta -u Clark"
    beginning-of-file
    search-forward "^[ \t]*$"
    set-named-mark q
    ~force down-line
    insert-string %phrase
    ~force up-line-at-bol
    filter-til end-of-file %cmd
    goto-named-mark q
    down-line
    ~force delete-til search-forward "--*BEGIN PGP SIGNED MESSAGE"
~endm
bind-key execute-macro-21 #-t   ; invoke with the keystroke #t

;
; Same macro as above, except that the entire buffer is signed.
;
22 store-macro

    write-message " "  ; erase passphrase
    set-variable %var "setenv PGPPASSFD 0;"
    set-variable %cmd &cat %var "pgp -fsta -u Clark"
    beginning-of-file
    insert-string %phrase
    ~force up-line-at-bol
    filter-til end-of-file %cmd
    beginning-of-file
    ~force delete-til search-forward "--*BEGIN PGP SIGNED MESSAGE"
~endm
bind-key execute-macro-22 #-T   ; invoke with the keystroke #T

--

 
 
 

1. Summary: vile: print buffer macro

Below is a summary of the responses I received for a macro to
print the contents of a vile buffer.  Several people wondered
why I felt the need for a macro, and I should have stated the
following up front:

1) If a read-only file is loaded, the write file key mappings
   won't work
2) If the buffer has been modified, the file could be a candidate
   for writing to disk before printing.
3) The command I use for printing does not take STDIN input, it
   must have a file name - hence the need for a write to disk
   operation.

Anyway, here are the responses I received via email...

1) use a key-mapping to pipe the file to the print spooler
2) use the following...
1 store-macro
    write-file "/tmp/vile.print"
    write-message "Printing buffer..."
    shell-command &cat "trueprint " $cfilname
    shell-command "rm -f /tmp/vile.print"
~endm
bind-key execute-macro-1 p
;

Thanks to T.E. Dickey and Kevin Brannen and Paul Fox for sending me
email.

lj

2. Loose Joint & Marcio (FSF) Meeting Hip Hop in Valinhos-Brazil

3. vile: print buffer macro

4. Phone # and address for Cross Products

5. How PGP Signed Keys Work (Was: How PGP Works)

6. A2000/Toaster with DPS TBC $1500

7. vile macro for HTML

8. Two computer LAN problem

9. vile macros

10. vile macro to ispell USENET posting or email msg

11. useful macros for vile

12. VILE: macro question