|
|
1.1 root 1: Newsgroups: alt.security.pgp
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
5: Organization: MIT Laboratory for Computer Science
6: Distribution: alt
7: Date: Thu, 4 Mar 1993 22:01:03 GMT
8:
9: Here's a somewhat improved version of my Emacs interface to PGP,
10: pgp.el-0.2.
11:
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.
15:
16: After loading this up, type C-c p h for a usage summary.
17:
18: Consider this a beta release. Some egregious known bugs are:
19:
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.
24:
25: Mike
26: ========== cut here =============
27: ;;;
28: ;;; pgp.el-0.2 -- Emacs support for PGP 2.1
29: ;;;
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!
41: ;;;
42: ;;; People can see your PGP passphrase if:
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.
47: ;;;
48: ;;; Plus the system suffers from all the normal Unix and X-windows
49: ;;; security holes.
50: ;;;
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.")
58:
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): "))))
66:
67: (defun pgp-clear-passphrase ()
68: "Clears the PGP pass phrase."
69: (interactive)
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)))
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")
90: (pgp-ensure-passphrase)
91: (shell-command-on-region start end
92: (concat "pgp -f -z \"" pgp-passphrase "\"")
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")
101: (pgp-ensure-passphrase)
102: (shell-command-on-region start end (concat "pgp -safe " pgp-user-id
103: " -z \"" pgp-passphrase "\"")
104: (not flag)))
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")
111: (pgp-ensure-passphrase)
112: (shell-command-on-region start end (concat "pgp -saft +clearsig=on"
113: " -z \"" pgp-passphrase "\"")
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:
121: ;; kill the status information immediately after running PGP on a region
122: ;; (not very robust yet).
123: (fset 'pgp-kill-status
124: "-----
125:
126: (defun pgp-describe ()
127: "Describe the PGP package.
128:
129: Quick usage summary:
130:
131: Default
132: Key
133: Binding Command name Description
134: ======= =========================== =========================================
135: C-c p p pgp-set-passphrase Prompts for entry of passphrase. With
136: ange-ftp loaded, this is invisible.
137: C-c p c pgp-clear-passphrase Clears the passphrase from emacs memory.
138: (Not very thoroughly; see below.)
139: C-c p e pgp-encrypt-region Prompts for recipient. Output in place
140: unless prefixed.
141: C-c p d pgp-decrypt-region Prompts for passphrase if unknown.
142: Output in place unless prefixed.
143: C-c p s pgp-sign-region Uses CLEARSIG. Prompts for passphrase
144: if unknown. Output in place unless C-u.
145: C-c p S pgp-sign-and-encrypt-region Prompts for recipient and passphrase if
146: unknown. Output in place unless C-u.
147: C-c p v pgp-verify-region Checks signature for validity. Output in
148: separate window.
149: C-c p k pgp-kill-status Done immediately after C-c p s,
150: kills the PGP status information.
151: C-c p h pgp-describe Show this documentation.
152:
153: WARNING: Security Holes:
154: People can see your PGP passphrase if:
155: * You don't have ange-ftp and they see you typing in your passphrase.
156: * They (intentionally or accidentally) do a \"ps\" (with appropriate options)
157: on your machine while you're decrypting/signing.
158: * They type C-h v pgp-passphrase after you've entered it.
159:
160: Plus the system suffers from all the normal Unix and X-windows
161: security holes.
162:
163: More documentation to come."
164: (interactive)
165: (describe-function 'pgp-describe))
166:
167: (global-set-key "\C-cpp" 'pgp-set-passphrase)
168: (global-set-key "\C-cpc" 'pgp-clear-passphrase)
169: (global-set-key "\C-cpe" 'pgp-encrypt-region)
170: (global-set-key "\C-cpd" 'pgp-decrypt-region)
171: (global-set-key "\C-cps" 'pgp-sign-region)
172: (global-set-key "\C-cpS" 'pgp-sign-and-encrypt-region)
173: (global-set-key "\C-cpv" 'pgp-verify-region)
174: (global-set-key "\C-cpk" 'pgp-kill-status)
175: (global-set-key "\C-cph" 'pgp-describe)
176: (global-set-key "\C-cp?" 'pgp-describe)
177: --
178: , , __ MIT Lab for Computer Science
179: /|/| . _ |_ _ _ | |_ _ _ ,_ |, [email protected]
180: / | | | (_ | | (_| (-' | | | (_| | | |\ (Finger for PGP Public Key)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.