|
|
1.1 root 1: Newsgroups: alt.security.pgp 1.1.1.2 ! root 2: From: [email protected] (Michael P. Frank) ! 3: Subject: New version of Emacs interface to PGP ! 4: In-Reply-To: [email protected]'s message of Wed, 3 Mar 1993 14:06:47 +0000 1.1 root 5: Organization: MIT Laboratory for Computer Science 6: Distribution: alt 1.1.1.2 ! root 7: Date: Thu, 4 Mar 1993 22:01:03 GMT 1.1 root 8: 1.1.1.2 ! root 9: Here's a somewhat improved version of my Emacs interface to PGP, ! 10: pgp.el-0.2. 1.1 root 11: 1.1.1.2 ! root 12: Some bugs are fixed since the last version. The main improvement is ! 13: that if you have ange-ftp loaded, then pgp-set-passphrase will use it ! 14: to prompt for your passphrase invisibly. 1.1 root 15: 1.1.1.2 ! root 16: After loading this up, type C-c p h for a usage summary. 1.1 root 17: 1.1.1.2 ! root 18: Consider this a beta release. Some egregious known bugs are: 1.1 root 19: 1.1.1.2 ! root 20: * Other users on the system can see your pass phrase using ! 21: "ps" and fortuitous timing. ! 22: * After decrypting, pgp's output "Pass phrase is good." is ! 23: stuck on the beginning of the plaintext. 1.1 root 24: 1.1.1.2 ! root 25: Mike ! 26: ========== cut here ============= ! 27: ;;; ! 28: ;;; pgp.el-0.2 -- Emacs support for PGP 2.1 1.1 root 29: ;;; 1.1.1.2 ! root 30: ;;; Changes from 0.1: ! 31: ;;; pgp-clear-passphrase bug fixed. ! 32: ;;; If ange-ftp is loaded, password is entered invisibly. ! 33: ;;; On-line help. ! 34: ;;; Immediately after signing in place, C-c p k can be used to delete ! 35: ;;; pgp status garbage. ! 36: ;;; ! 37: ;;; 0.1 Changes from 0.0: ! 38: ;;; Inconsistent naming of pgp-set-passphrase fixed. ! 39: ;;; ! 40: ;;; WARNING: Security Holes! 1.1 root 41: ;;; 42: ;;; People can see your PGP passphrase if: 1.1.1.2 ! root 43: ;;; * You don't have ange-ftp and they see you typing in your passphrase. ! 44: ;;; * They (intentionally or accidentally) do a "ps" (with appropriate options) ! 45: ;;; on your machine while you're decrypting/signing. ! 46: ;;; * They type C-h v pgp-passphrase after you've entered it. 1.1 root 47: ;;; 48: ;;; Plus the system suffers from all the normal Unix and X-windows 49: ;;; security holes. 50: ;;; 1.1.1.2 ! root 51: ;;; Please report any bugs to [email protected]. ! 52: ;;; You can finger me for my public key. ! 53: ;;; ! 54: ! 55: (defvar pgp-passphrase nil ! 56: "Variable used internally by the Emacs PGP interface to hold ! 57: the user's pass phrase.") 1.1 root 58: 1.1.1.2 ! root 59: (defun pgp-set-passphrase () ! 60: "Prompts for PGP pass phrase. If ange-ftp is loaded, password is invisible." ! 61: (interactive) ! 62: (setq pgp-passphrase ! 63: (if (boundp 'ange-ftp-version) ! 64: (ange-ftp-read-passwd "PGP pass phrase (invisible): ") ! 65: (read-string "PGP pass phrase (not invisible): ")))) 1.1 root 66: 67: (defun pgp-clear-passphrase () 68: "Clears the PGP pass phrase." 69: (interactive) 1.1.1.2 ! root 70: (setq pgp-passphrase nil)) ! 71: ! 72: (defun pgp-ensure-passphrase () ! 73: "Not an interactive command. If the passphrase is not set, prompts for it." ! 74: (if (not pgp-passphrase) ! 75: (call-interactively 'pgp-set-passphrase))) 1.1 root 76: 77: (defun pgp-encrypt-region (start end pgp-user-id &optional flag) 78: "Encrypt the region using PGP. Prompts for a PGP user ID. 79: With prefix arg, puts result in serparate window. 80: Noninteractive args are START, END, PGP-USER-ID, and optional FLAG." 81: (interactive "r\nsUser ID to encrypt to: \nP") 82: (shell-command-on-region start end (concat "pgp -fea " pgp-user-id) 83: (not flag))) 84: 85: (defun pgp-decrypt-region (start end &optional flag) 86: "Decrypt the region using PGP. Prompts for the user's pass phrase, 87: if not already known. With prefix arg, puts result in separate window. 88: Noninteractive args are START and END and optional FLAG." 89: (interactive "r\nP") 1.1.1.2 ! root 90: (pgp-ensure-passphrase) 1.1 root 91: (shell-command-on-region start end 1.1.1.2 ! root 92: (concat "pgp -f -z \"" pgp-passphrase "\"") 1.1 root 93: (not flag))) 94: 95: (defun pgp-sign-and-encrypt-region (start end pgp-user-id &optional flag) 96: "Sign and encrypt the region using PGP. Prompts for a user to 97: encrypt to and a pass phrase, if not already known. 98: With prefix arg puts result in separate window. 99: Noninteractive args are START, END, and PGP-USER-ID, and optional FLAG." 100: (interactive "r\nsUser ID to encrypt to: \nP") 1.1.1.2 ! root 101: (pgp-ensure-passphrase) 1.1 root 102: (shell-command-on-region start end (concat "pgp -safe " pgp-user-id 1.1.1.2 ! root 103: " -z \"" pgp-passphrase "\"") ! 104: (not flag))) 1.1 root 105: 106: (defun pgp-sign-region (start end &optional flag) 107: "Sign the region using PGP. Prompts for a pass phrase, if not already 108: Known. With prefix arg puts result in separate window. 109: Noninteractive args are START and END and optional FLAG." 110: (interactive "r\nP") 1.1.1.2 ! root 111: (pgp-ensure-passphrase) 1.1 root 112: (shell-command-on-region start end (concat "pgp -saft +clearsig=on" 1.1.1.2 ! root 113: " -z \"" pgp-passphrase "\"") 1.1 root 114: (not flag))) 115: 116: (defun pgp-verify-region (start end) 117: "Verify the signature on the text in the given region using PGP." 118: (interactive "r") 119: (shell-command-on-region start end "pgp -f")) 120: 1.1.1.2 ! root 121: (defun pgp-describe () ! 122: "Describe the PGP package. ! 123: ! 124: Quick usage summary: ! 125: ! 126: Default ! 127: Key ! 128: Binding Command name Description ! 129: ======= =========================== ========================================= ! 130: C-c p p pgp-set-passphrase Prompts for entry of passphrase. With ! 131: ange-ftp loaded, this is invisible. ! 132: C-c p c pgp-clear-passphrase Clears the passphrase from emacs memory. ! 133: (Not very thoroughly; see below.) ! 134: C-c p e pgp-encrypt-region Prompts for recipient. Output in place ! 135: unless prefixed. ! 136: C-c p d pgp-decrypt-region Prompts for passphrase if unknown. ! 137: Output in place unless prefixed. ! 138: C-c p s pgp-sign-region Uses CLEARSIG. Prompts for passphrase ! 139: if unknown. Output in place unless C-u. ! 140: C-c p S pgp-sign-and-encrypt-region Prompts for recipient and passphrase if ! 141: unknown. Output in place unless C-u. ! 142: C-c p v pgp-verify-region Checks signature for validity. Output in ! 143: separate window. ! 144: C-c p k pgp-kill-status Done immediately after C-c p s, ! 145: kills the PGP status information. ! 146: C-c p h pgp-describe Show this documentation. ! 147: ! 148: WARNING: Security Holes: ! 149: People can see your PGP passphrase if: ! 150: * You don't have ange-ftp and they see you typing in your passphrase. ! 151: * They (intentionally or accidentally) do a \"ps\" (with appropriate options) ! 152: on your machine while you're decrypting/signing. ! 153: * They type C-h v pgp-passphrase after you've entered it. ! 154: ! 155: Plus the system suffers from all the normal Unix and X-windows ! 156: security holes. ! 157: ! 158: More documentation to come." ! 159: (interactive) ! 160: (describe-function 'pgp-describe)) ! 161: 1.1 root 162: (global-set-key "\C-cpp" 'pgp-set-passphrase) 163: (global-set-key "\C-cpc" 'pgp-clear-passphrase) 164: (global-set-key "\C-cpe" 'pgp-encrypt-region) 165: (global-set-key "\C-cpd" 'pgp-decrypt-region) 166: (global-set-key "\C-cps" 'pgp-sign-region) 167: (global-set-key "\C-cpS" 'pgp-sign-and-encrypt-region) 168: (global-set-key "\C-cpv" 'pgp-verify-region) 1.1.1.2 ! root 169: (global-set-key "\C-cpk" 'pgp-kill-status) ! 170: (global-set-key "\C-cph" 'pgp-describe) ! 171: (global-set-key "\C-cp?" 'pgp-describe) 1.1 root 172: -- 173: , , __ MIT Lab for Computer Science 174: /|/| . _ |_ _ _ | |_ _ _ ,_ |, [email protected] 175: / | | | (_ | | (_| (-' | | | (_| | | |\ (Finger for PGP Public Key)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.