home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / pgpamp1.zip / PGPAMP.CMD < prev    next >
OS/2 REXX Batch file  |  1994-04-10  |  6KB  |  264 lines

  1. /* PGPAMP.CMD version 1.0 Copyright 1994 04/10/94 by Alan M. Pugh */
  2.  
  3. /* PGPAMP is a shell to use with PGP. It requires that you have VREXX
  4. support enabled. PGP is a file encryption/decryption program. For this 
  5. command file to work, the PGPPATH environment variable must be set. 
  6. For instance, SET PGPPATH=C:\PGP\
  7.  
  8. This command file will prompt for a file to encrypt, or let you 
  9. create the file on the fly using the Enhance Editor.  
  10. PGPAMP.CMD is freeware. No warranty whatsoever is implied. 
  11.  
  12. When I encrypt a file, I am normally sending it through echomail or
  13. MCI Mail. This means that the file must be an ASCII file. Therefor,
  14. I've provided syntax for both "ASCII ARMORED" files and binary files.
  15. This program is shipped with ASCII output enabled. If you want it to
  16. produce binary output (which is smaller), edit this file to change
  17. the syntax that is called. */
  18.  
  19. '@echo off'
  20. call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
  21. initcode = VInit()
  22. if initcode = 'ERROR' then signal CLEANUP
  23.  
  24. signal on failure name CLEANUP
  25. signal on halt name CLEANUP
  26. signal on syntax name CLEANUP
  27.  
  28.  
  29. /* Main Menu */
  30.  
  31. main:
  32. main.0 = 7
  33. main.1  = "Clear Sign a File."
  34. main.2  = "Encrypt File to Person(s)."
  35. main.3  = "Sign a File and Encrypt to Person(s)"
  36. main.4  = "Encrypt using DES Encryption"
  37. main.5  = "Decrypt a File"
  38. main.6  = "Key Management Commands"
  39. main.7  = "Exit Program"
  40. main.vstring = main.1          /* default selection */
  41.  
  42. call VDialogPos 25, 25
  43. call VListBox "Make Selection Press OK", main, 35, 8, 1
  44.  
  45. if main.vstring="Exit Program"
  46. then
  47. call cleanup
  48.  
  49. if main.vstring="Clear Sign a File."
  50. then
  51. do 
  52. call getfile
  53. call get2file
  54.     "pgp -sta +clearsig=on " file "-o " file2
  55. end
  56.  
  57. if main.vstring="Encrypt File to Person(s)."
  58. then
  59. do
  60.    call getfile
  61.    call getname
  62.    call get2file
  63. /*   "pgp -e " file name "-o " file2 */       /* Binary output */
  64.    "pgp -ea " file name "-o " file2           /* ASCII output */
  65. end
  66.  
  67. if main.vstring="Sign a File and Encrypt to Person(s)"
  68. then
  69. do
  70.    call getfile
  71.    call getname
  72.    call get2file
  73. /*   "pgp -es " file '"'name'"' "-o " file2 */  /* Binary output */
  74.    "pgp -sea " file '"'name'"' "-o " file2    /* ASCII output */
  75. end
  76.  
  77. if main.vstring="Encrypt using DES Encryption"
  78. then
  79. do
  80.    call getfile
  81.    call get2file
  82. /*   "pgp -c " file "-o "file2 */             /* Binary output */
  83.    "pgp -ca " file "-o "file2                 /* ASCII output */
  84. end
  85.  
  86. if main.vstring="Decrypt a File"
  87. then
  88. do
  89.    call getfile
  90.    call get2file
  91.    "pgp " file "-o " file2
  92. end
  93.  
  94. if main.vstring="Key Management Commands"
  95. then 
  96. call keymgmt
  97.  
  98.  
  99. call main 
  100.  
  101. /* this section gets names or files */
  102.  
  103. getfile:
  104. call VDialogPos 10, 50
  105. button = VFileBox("Pick the file to encrypt...", "*.*", "fname")
  106. file=fname.vstring
  107. if button= "CANCEL" 
  108. then 
  109. call cancelled
  110.  
  111. return
  112.  
  113.  
  114. get2file:
  115. call VDialogPos 10, 50
  116. button = VFileBox("Choose a Target Filename...", "*.*", "fname")
  117. file2=fname.vstring
  118. if button= "CANCEL" 
  119. then 
  120. call cancelled
  121.  
  122. return
  123.  
  124. call MAIN
  125.  
  126.  
  127. /* this section gets names */
  128. getname:
  129. persname.0 = 2
  130. persname.1 = "Enter name of recipient"
  131. persname.2 = "(First Last)"
  132. persname.vstring = "John Doe"
  133. button = VInputBox("Enter Name Please", persname, 20, 3)
  134. name=persname.vstring
  135. if button= "CANCEL" 
  136. then 
  137. call cancelled
  138. return
  139.  
  140.  
  141. cancelled:
  142.  
  143. msg.0 = 2
  144. msg.1 = 'You pressed CANCEL.'
  145. msg.2 = 'Returning you to MAIN'
  146.  
  147. rb = VMsgBox('PGPAMP', msg, 1)
  148. call main
  149.  
  150.  
  151. /* this is the key management section */
  152. keymgmt:
  153.  
  154. key.0 = 12
  155. key.1  = "Add a Key to Your Public Key"
  156. key.2  = "Extract a Key From Your Public Key"
  157. key.3  = "Extract an ASCII Key From Your Public Key"
  158. key.4  = "View a Key's Fingerprint"
  159. key.5  = "View Your Public Key's Contents"
  160. key.6  = "View Public Key Contents Verbosely"
  161. key.7  = "Edit your Private Key's PassPhrase"
  162. key.8  = "Sign Someone's Public Key"
  163. key.9  = "Disable/Enable a Key"
  164. key.10  = "Detatch Signature From Signed Document"
  165. key.11  = "Goto Main Menu"
  166. key.12  = "Exit Program"
  167. key.vstring = key.11          /* default selection */
  168.  
  169. call VDialogPos 25, 25
  170. call VListBox "Make Selection Press OK", key, 55, 13, 1
  171.  
  172. if key.vstring= "Add a Key to Your Public Key"
  173. then
  174. do
  175.    call getfile
  176.    "pgp -ka " file
  177. end
  178.  
  179. if key.vstring= "Extract a Key From Your Public Key"
  180. then 
  181. do
  182.    call getname
  183.    "pgp -kx "  '"'name'"'                 /* Binary output */
  184. /*   "pgp -kxa "  '"'name'"' */           /* ASCII output */
  185. end
  186.  
  187. if key.vstring= "Extract an ASCII Key From Your Public Key"
  188. then 
  189. do
  190.    call getname
  191. /*   "pgp -kx "  '"'name'"'   */     /* Binary output */
  192.    "pgp -kxa "  '"'name'"'           /* ASCII output */
  193.   
  194. end
  195.  
  196. if key.vstring= "View a Key's Fingerprint"
  197. then 
  198. do
  199.    call getname
  200.    "pgp -kvc "  name
  201.    say "Press a key to return..."
  202.    pull
  203. end
  204.  
  205. if key.vstring= "View Your Public Key's Contents"
  206. then 
  207. do
  208.    "pgp -kv | more"  
  209.    say "Press a key to return..."
  210.    pull
  211. end
  212.  
  213. if key.vstring= "View Public Key Contents Verbosely"
  214. then 
  215. do
  216.    "pgp -kvv | more"
  217.    say "Press a key to return..."
  218.    pull
  219. end
  220.  
  221. if key.vstring= "Edit your Private Key's PassPhrase"
  222. then 
  223. do
  224.    "pgp -ke "  
  225.    say "Press a key to return..."
  226.    pull
  227. end
  228.  
  229. if key.vstring= "Sign Someone's Public Key"
  230. then 
  231. do
  232.    call getname
  233.    "pgp -ks "  '"'name'"'
  234. end
  235.  
  236. if key.vstring= "Disable/Enable a Key"
  237. then 
  238. do
  239.    call getname
  240.    "pgp -kd " '"'name'"'
  241. end
  242.  
  243. if key.vstring= "Detatch Signature From Signed Document"
  244. then 
  245. do
  246.    call getfile
  247.    "pgp -b "  file
  248. end
  249.  
  250. if key.vstring= "Goto Main Menu"
  251. then
  252. call main
  253.  
  254. if key.vstring= "Exit Program"
  255. then call cleanup
  256.  
  257. call keymgmt
  258.  
  259. CLEANUP:
  260.    call VExit
  261.  
  262. exit
  263.  
  264.