.KEY cryptfile/A,cryptmode/A
;
; EncryptMsg using PGP
;
; written by Peter Simons <simons@peti.GUN.de>
;

.BRA {
.KET }
FailAt 1

SplitHeadBody <{cryptfile} T:header.$PROCESS T:body.$PROCESS

If "{cryptmode}" EQ "ENCRYPT"
        RequestString RECEIPIENTS "Please enter receipient(s) ID(s)..." 256
        PGP -ftea <T:body.$PROCESS >{cryptfile}.asc $RECEIPIENTS
        UnSet $RECEIPIENTS
Else
If "{cryptmode}" EQ "SIGN"
        PGP -ftsa <T:body.$PROCESS >{cryptfile}.asc +clearsig=on
Else
If "{cryptmode}" EQ "ENCRYPT+SIGN"
        RequestString RECEIPIENTS "Please enter receipient(s) ID(s)..." 256
        PGP -ftesa <T:body.$PROCESS >{cryptfile}.asc $RECEIPIENTS
        UnSet $RECEIPIENTS
EndIf
EndIf
EndIf

;
; now copy the encrypted message back
; and get rid of our temporary file
;
Delete {cryptfile} QUIET FORCE
Rename T:header.$PROCESS {cryptfile}
Echo "*N" >>{cryptfile} NOLINE
Type {cryptfile}.asc >>{cryptfile}
Delete {cryptfile}.asc T:header.$PROCESS T:body.$PROCESS QUIET FORCE

