home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / comm / fido / spot / rexx / pgp / signtext.spot < prev    next >
Text File  |  1994-05-12  |  3KB  |  105 lines

  1. /* SignText.spot Version 1.0 © 1994 by Chris Dee                            */
  2. /*   (Based on Encrypt.spot Version 1.2 © 1993 by Wim Van Goethem)          */
  3. /*                                                                          */
  4. /* This Arexx script is intended to sign your current displayed msg (with   */
  5. /* PGP). It uses PGP which has been ported to the Amiga by Peter Simons.    */
  6. /*                                                                          */
  7. /* For comments, remarks, bugs, etc. contact:                               */
  8. /* Fidonet: 2:286/407.34 (Chris Dee)                                        */
  9. /* Internet: cd@grafix.wlink.nl                                             */
  10.  
  11. /* Path were you keep PGP (must end on "/" or ":" or be empty) */
  12. PGPpath = "Mail:Bin/"
  13.  
  14. address spot
  15. options results
  16.  
  17. if ~show(Libraries,'rexxsupport.library') then
  18.     if ~addlib("rexxsupport.library",0,-30,0) then exit
  19.  
  20. 'saveascii TO T:pgptemp_a OVERWRITE NOTEARLINE NOORIGIN NOKLUDGES' /* Save the msg */
  21.  
  22. /* Get all headerinfo */
  23. 'getfrom'
  24. from_name = result
  25.  
  26. /* Let's get the password */ 
  27. if ~exists("env:PGPPASS") then  /* We suppose that this password is correct, we do not test any further */
  28. do
  29.     foo = open('file','T:pgptemp_x','W')    /* This is a testfile */
  30.     foo = writeln('file','Testing...')
  31.     foo = close('file')
  32.     do until rc == 0     /* if rc = 0 , the password is valid */
  33.         address spot
  34.         'requeststring PROMPT "     Please give your password     " TITLE "Make signature" INVISIBLE'
  35.         if rc == 5 then  /* User pressed 'Cancel' */
  36.         do
  37.             foo = delete('T:pgptemp_x')
  38.             foo = delete('T:pgptemp_x.asc')
  39.             foo = delete('T:pgptemp_a')
  40.             foo = delete('env:PGPPASS')
  41.             say "Please close window to quit."
  42.             exit
  43.         end
  44.         address command ""setenv PGPPASS ""||result||""
  45.         /* Is it correct? */
  46.         address command PGPpath'PGP >NIL: +batchmode -sa T:pgptemp_x -u "'from_name'"'
  47.         foo = delete('T:pgptemp_x.asc')
  48.     end
  49.     foo = delete('T:pgptemp_x')
  50. end
  51.  
  52. /* Delete the five first lines from the msg */
  53. foo = open('infile','T:pgptemp_a','R')
  54. foo = open('outfile','T:pgptemp_b','W')
  55. do x=1 to 5
  56.     foo = readln('infile')
  57. end
  58.  
  59. /* Check for the To: klugde */
  60. instring = readln('infile')
  61. ok = pos('To:', instring)
  62. if ok == 0 then
  63. do
  64.     /* To: kludge not found so let's put this line in the output file */
  65.     foo = writeln('outfile',instring)
  66. end
  67. else
  68. do
  69.     /* To: kludge found so let's strip the next line, which is empty, too */
  70.     foo = readln('infile')
  71. end
  72.  
  73. do while ~eof('infile')
  74.     instring = readln('infile')
  75.     foo = writeln('outfile',instring)
  76. end
  77. foo = close('infile')
  78. foo = close('outfile')
  79. foo = delete('T:pgptemp_a') /* We won't need this anymore */
  80.  
  81. /* Sign the msg with PGP */
  82. options failat 100
  83. address command PGPpath'PGP +clearsig +batchmode -ftsa <T:pgptemp_b >T:pgptemp_c -u "'from_name'"'
  84. if rc ~= 0 then do
  85.     foo = delete('T:pgptemp_b')
  86.     foo = delete('T:pgptemp_c')
  87.     say ""
  88.     say ""
  89.     say "Please close window to quit."
  90.     exit
  91.     end
  92.  
  93. /* Put the signed msg back into the message base */
  94. address spot
  95. 'edit FILE T:pgptemp_c REFLOW=OFF NOEDIT NOGUI NOSIG NOREQ'
  96.  
  97. foo = delete('T:pgptemp_b')
  98. foo = delete('T:pgptemp_c')
  99.  
  100. /* Quit */
  101. say ""
  102. say ""
  103. say "Please close window to quit."
  104. exit
  105.