| 1 |
;;; mew-pgp.el --- PGP/MIME for Mew |
| 2 |
|
| 3 |
;; Author: Kazu Yamamoto <[email protected]> |
| 4 |
;; Created: Aug 17, 1994 |
| 5 |
|
| 6 |
;;; Code: |
| 7 |
|
| 8 |
(require 'mew) |
| 9 |
|
| 10 |
;;; |
| 11 |
;;; PGP 2.6.x is supported. |
| 12 |
;;; PGP 5.x is supported. But very ad-hoc. |
| 13 |
;;; GNUPG 1.0.2 or later is supported. |
| 14 |
;;; PGP 6.x is supported. But very ad-hoc. |
| 15 |
;;; |
| 16 |
|
| 17 |
(defvar mew-pgp-ver nil |
| 18 |
"Automatically set 0 if PGP version is 2. |
| 19 |
Set 1 if 5. Set 2 if 6. Set 3 if GNUPG. Set 4 if GNUPG2.") |
| 20 |
|
| 21 |
(defconst mew-pgp-ver2 0) |
| 22 |
(defconst mew-pgp-ver5 1) |
| 23 |
(defconst mew-pgp-ver6 2) |
| 24 |
(defconst mew-pgp-verg 3) |
| 25 |
(defconst mew-pgp-verg2 4) |
| 26 |
(defconst mew-pgp-list '("PGPv2" "PGPv5" "PGPv6" "GNUPG" "GNUPG2")) |
| 27 |
(defconst mew-pgp-keys '(pgpv2 pgpv5 pgpv6 gnupg gnupg2)) ;; use symbols, cases are string |
| 28 |
|
| 29 |
;; mew-prog-pgp is used only for version check |
| 30 |
(defvar mew-prog-pgp2 "pgp") ;; "pgp263i", PGP selection |
| 31 |
(defvar mew-prog-pgp5 "pgp") ;; PGP selection |
| 32 |
(defvar mew-prog-pgp5e "pgpe") |
| 33 |
(defvar mew-prog-pgp5s "pgps") |
| 34 |
(defvar mew-prog-pgp5v "pgpv") |
| 35 |
(defvar mew-prog-pgp5k "pgpk") |
| 36 |
(defvar mew-prog-pgp6 "pgp") ;; "pgp651i", PGP selection |
| 37 |
(defvar mew-prog-gpg "gpg") ;; PGP selection |
| 38 |
(defvar mew-prog-gpg2 "gpg") ;; PGP selection |
| 39 |
|
| 40 |
(defvar mew-prog-pgpe |
| 41 |
`(,mew-prog-pgp2 ,mew-prog-pgp5e ,mew-prog-pgp6 ,mew-prog-gpg ,mew-prog-gpg2)) |
| 42 |
(defvar mew-prog-pgps |
| 43 |
`(,mew-prog-pgp2 ,mew-prog-pgp5s ,mew-prog-pgp6 ,mew-prog-gpg ,mew-prog-gpg2)) |
| 44 |
(defvar mew-prog-pgpv |
| 45 |
`(,mew-prog-pgp2 ,mew-prog-pgp5v ,mew-prog-pgp6 ,mew-prog-gpg ,mew-prog-gpg2)) |
| 46 |
(defvar mew-prog-pgpd |
| 47 |
`(,mew-prog-pgp2 ,mew-prog-pgp5v ,mew-prog-pgp6 ,mew-prog-gpg ,mew-prog-gpg2)) |
| 48 |
(defvar mew-prog-pgpk |
| 49 |
`(,mew-prog-pgp2 ,mew-prog-pgp5k ,mew-prog-pgp6 ,mew-prog-gpg ,mew-prog-gpg2)) |
| 50 |
|
| 51 |
(defconst mew-prog-pgpe-arg |
| 52 |
'(("-ea" "+language=en" "+batchmode=on" "+armorlines=0") |
| 53 |
("-a" "+language=en" "+batchmode=on" "+armorlines=0") |
| 54 |
("-ea" "+language=en" "+batchmode=on" "+armorlines=0") |
| 55 |
("--encrypt" "--armor" "--batch") |
| 56 |
("--encrypt" "--armor" "--batch"))) |
| 57 |
|
| 58 |
(defconst mew-prog-pgpd-arg |
| 59 |
'(("+language=en" "+batchmode=off") |
| 60 |
("+language=en" "+batchmode=off") |
| 61 |
("+language=en" "+batchmode=off") |
| 62 |
("--decrypt") |
| 63 |
("--decrypt"))) |
| 64 |
|
| 65 |
(defvar mew-prog-pgps-arg ;; local binding |
| 66 |
'(("-sba" "+language=en" "+batchmode=off") |
| 67 |
("-ba" "+language=en" "+batchmode=off") |
| 68 |
("-sba" "+language=en" "+batchmode=off") |
| 69 |
("--detach-sign" "--armor" "--status-fd" "1") |
| 70 |
("--detach-sign" "--armor" "--status-fd" "1" "--command-fd" "0" "--no-tty" "--yes"))) |
| 71 |
|
| 72 |
(defconst mew-prog-pgpv-arg |
| 73 |
'(("+batchmode=on" "+language=en") |
| 74 |
("+batchmode=on" "+language=en" "+force=on") |
| 75 |
("+batchmode=on" "+language=en") |
| 76 |
("--verify" "--batch") |
| 77 |
("--verify" "--batch"))) |
| 78 |
|
| 79 |
(defconst mew-prog-old-pgpv-arg |
| 80 |
'(("+batchmode=on" "+language=en") |
| 81 |
("+batchmode=on" "+language=en" "+force=on") |
| 82 |
("+batchmode=on" "+language=en") |
| 83 |
("--decrypt" "--batch") ;; --verify does not extract original data |
| 84 |
("--decrypt" "--batch"))) |
| 85 |
|
| 86 |
(defconst mew-prog-pgp-arg-output '("-o" "-o" "-o" "--output" "--output")) |
| 87 |
(defconst mew-prog-pgp-arg-input '(nil "-o" nil nil nil)) |
| 88 |
(defconst mew-prog-pgp-arg-luserid '("-u" "-u" "-u" "--local-user" "--local-user")) |
| 89 |
(defconst mew-prog-pgp-arg-ruserid '(nil "-r" nil "--remote-user" "--remote-user")) |
| 90 |
|
| 91 |
(defconst mew-prog-pgpk-add-arg |
| 92 |
'(("-ka" "+batchmode=on") |
| 93 |
("-a" "+batchmode=on") |
| 94 |
("-ka" "+batchmode=on") |
| 95 |
("--import" "--batch") |
| 96 |
("--import" "--batch"))) |
| 97 |
|
| 98 |
(defconst mew-prog-pgpk-ext-arg |
| 99 |
'(("-kxfa") ("-xa") ("+force" "-kxfa") ("--export" "--armor" "--batch") ("--export" "--armor" "--batch"))) |
| 100 |
|
| 101 |
(defconst mew-pgp-msg-signature |
| 102 |
'("\n\\(.*\\) signature from user \\(.*\\)\\." |
| 103 |
"\n\\(.*\\) signature made" |
| 104 |
"\\([a-zA-Z0-9]*\\) signature from user \\(.*\\)\\." |
| 105 |
" \\(.*\\) signature from \"\\(.*\\)\"" |
| 106 |
" \\(.*\\) signature from \"\\(.*\\)\"")) |
| 107 |
|
| 108 |
(defconst mew-pgp-msg-key-id |
| 109 |
'("Key ID \\([a-zA-Z0-9]+\\) not found" |
| 110 |
": 0x\\([a-zA-Z0-9]+\\)" |
| 111 |
": 0x\\([a-zA-Z0-9]+\\)" |
| 112 |
"key ID \\([a-zA-Z0-9]+\\)" |
| 113 |
"key ID \\([a-zA-Z0-9]+\\)")) |
| 114 |
|
| 115 |
(defconst mew-pgp-msg-bad-pass |
| 116 |
'("No passphrase" |
| 117 |
"Cannot unlock private key\\|It can only be decrypted" |
| 118 |
"Bad pass phrase" |
| 119 |
"bad passphrase" |
| 120 |
"bad passphrase")) |
| 121 |
|
| 122 |
(defconst mew-pgp-msg-enter |
| 123 |
'("Enter" "Enter" "Enter" "xxx" "xxx")) |
| 124 |
|
| 125 |
(defconst mew-pgp-msg-overwrite |
| 126 |
'("Overwrite (y/N)\\? " |
| 127 |
"Overwrite (y/N)\\? " |
| 128 |
"Overwrite (y/N)\\? " |
| 129 |
"Overwrite (y/N)\\? " |
| 130 |
"Overwrite (y/N)\\? ")) |
| 131 |
|
| 132 |
(defconst mew-pgp-msg-enter-pass |
| 133 |
'("Enter pass phrase: " |
| 134 |
"Enter pass phrase: " |
| 135 |
"Enter pass phrase: " |
| 136 |
"Enter passphrase: " |
| 137 |
"Enter passphrase: ")) |
| 138 |
|
| 139 |
(defconst mew-pgp-msg-reenter-pass |
| 140 |
'("Enter pass phrase: " |
| 141 |
"Enter pass phrase: " |
| 142 |
"Enter pass phrase: " |
| 143 |
"Enter passphrase: " |
| 144 |
"Enter passphrase: ")) |
| 145 |
|
| 146 |
(defconst mew-pgp-msg-no-enckey |
| 147 |
'("Key matching" |
| 148 |
"No encryption keys" |
| 149 |
"public key matching" |
| 150 |
"public key not found" |
| 151 |
"public key not found")) |
| 152 |
|
| 153 |
(defconst mew-pgp-msg-no-validkey |
| 154 |
'("DUMMY" |
| 155 |
"^WARNING:[ -9;-~\n]+belongs? to:" |
| 156 |
"^WARNING:[ -9;-~\n]+belongs? to:" |
| 157 |
"There is no indication that this key really belongs to the owner" |
| 158 |
"There is no indication that this key really belongs to the owner")) |
| 159 |
|
| 160 |
(defconst mew-pgp-msg-pubkey-expired |
| 161 |
'("xxx" |
| 162 |
"xxx" |
| 163 |
"xxx" |
| 164 |
"encryption failed: unusable public key" |
| 165 |
"encryption failed: unusable public key")) |
| 166 |
|
| 167 |
(defconst mew-pgp-msg-no-vrfkey |
| 168 |
'("Key matching" "unknown keyid" "key does not meet" "public key not found" "public key not found")) |
| 169 |
|
| 170 |
(defconst mew-pgp-msg-no-keyring |
| 171 |
'("Keyring file" "Keyring file" "NO MESSAGE" "public key not found" "public key not found")) |
| 172 |
|
| 173 |
(defconst mew-pgp-msg-no-seckey-or-secring |
| 174 |
'("You do not have the secret key" |
| 175 |
"Cannot find a private key" |
| 176 |
"Signature error\\|You do not have the secret key" |
| 177 |
"failed: secret key not available" |
| 178 |
"failed: secret key not available")) |
| 179 |
|
| 180 |
(defconst mew-pgp-msg-unsupported |
| 181 |
'("Unsupported packet format" ;; including algorithms and packets |
| 182 |
"Unsupported packet format\\|None of the signatures were understood" |
| 183 |
"Unsupported packet format" ;; including algorithms and packets |
| 184 |
"xxx" |
| 185 |
"xxx")) |
| 186 |
|
| 187 |
(defconst mew-pgp-msg-nocross |
| 188 |
'("xxx" |
| 189 |
"xxx" |
| 190 |
"xxx" |
| 191 |
"is not cross-certified" |
| 192 |
"is not cross-certified")) |
| 193 |
|
| 194 |
(defconst mew-pgp-verify-addr |
| 195 |
'(".* \\(signature from user\\) " |
| 196 |
"\\( \\)" |
| 197 |
".* \\(signature from user\\) " |
| 198 |
"gpg: .* \\(from\\|aka\\) " |
| 199 |
"gpg: .* \\(from\\|aka\\) ")) |
| 200 |
|
| 201 |
;; 2: ASCII armor corrupted |
| 202 |
;; 3: |
| 203 |
;; 5: |
| 204 |
|
| 205 |
;; 2: ERROR: or Error: |
| 206 |
|
| 207 |
(defconst mew-pgp-msg-no-export-key |
| 208 |
'("Key not found" "No keys" "Key not found" "nothing exported" "nothing exported")) |
| 209 |
|
| 210 |
(defvar mew-pgp-micalg '("pgp-md5" "pgp-sha1" "pgp-sha1" "pgp-sha1" "pgp-sha1")) |
| 211 |
|
| 212 |
(defvar mew-pgp-hash-alist |
| 213 |
'(("1" . "pgp-md5") |
| 214 |
("2" . "pgp-sha1") |
| 215 |
("3" . "pgp-ripemd160") |
| 216 |
("5" . "pgp-md2") |
| 217 |
("6" . "pgp-tiger192") |
| 218 |
("7" . "pgp-haval-5-160") |
| 219 |
("8" . "pgp-sha256") |
| 220 |
("9" . "pgp-sha384") |
| 221 |
("10" . "pgp-sha512"))) |
| 222 |
|
| 223 |
;; |
| 224 |
;; |
| 225 |
|
| 226 |
(defvar mew-pgp-string nil) |
| 227 |
(defvar mew-pgp-running nil) |
| 228 |
(defvar mew-pgp-failure nil) |
| 229 |
|
| 230 |
(defvar mew-pgp-decrypt-msg nil) |
| 231 |
(defvar mew-pgp-sign-msg nil) |
| 232 |
|
| 233 |
(defconst mew-pgp-encryption-begin "-----BEGIN PGP MESSAGE-----") |
| 234 |
(defconst mew-pgp-signature-begin "-----BEGIN PGP SIGNED MESSAGE-----") |
| 235 |
(defconst mew-pgp-key-begin "-----BEGIN PGP PUBLIC KEY BLOCK-----") |
| 236 |
(defconst mew-pgp-key-end "-----END PGP PUBLIC KEY BLOCK-----") |
| 237 |
|
| 238 |
(defconst mew-pgp-err-pass 'mew-err-pass) |
| 239 |
(defconst mew-pgp-err-pubring 'mew-err-pubring) |
| 240 |
(defconst mew-pgp-err-secring 'mew-err-secring) |
| 241 |
(defconst mew-pgp-err-pubkey 'mew-err-pubkey) |
| 242 |
(defconst mew-pgp-err-seckey 'mew-err-seckey) |
| 243 |
(defconst mew-pgp-err-seckey-or-secring 'mew-err-seckey-or-secring) |
| 244 |
(defconst mew-pgp-err-other 'mew-err-other) |
| 245 |
|
| 246 |
(defvar mew-pgp-result-pass "Pass phrase is wrong") |
| 247 |
(defvar mew-pgp-result-pubring "No public keyring") |
| 248 |
(defvar mew-pgp-result-secring "No secret keyring") |
| 249 |
(defvar mew-pgp-result-pubkey "No his/her public key") |
| 250 |
(defvar mew-pgp-result-expired "His/her public key is expired or not signed by yourself") |
| 251 |
(defvar mew-pgp-result-invalid |
| 252 |
"His/her public key is invalid. Sign the key by yourself, first") |
| 253 |
(defvar mew-pgp-result-seckey "No your secret key") |
| 254 |
(defvar mew-pgp-result-seckey-or-secring |
| 255 |
"No secret keyring or no your secret key") |
| 256 |
(defvar mew-pgp-result-other "PGP failed for some reasons") |
| 257 |
(defvar mew-pgp-result-sec-succ "PGP decrypted") |
| 258 |
(defvar mew-pgp-result-dec-fail "PGP NOT decrypted for some reasons") |
| 259 |
(defvar mew-pgp-result-unsup "PGP unsupported signature") |
| 260 |
(defvar mew-pgp-result-nocross "His/her Public key is not cross-certified") |
| 261 |
|
| 262 |
(defvar mew-pgp-prompt-enter-pass "Enter pass phrase (%s): ") |
| 263 |
(defvar mew-pgp-prompt-reenter-pass "Re-enter pass phrase (%s): ") |
| 264 |
|
| 265 |
(defun mew-pgp-get (list-or-vec) |
| 266 |
(elt list-or-vec mew-pgp-ver)) |
| 267 |
|
| 268 |
(defun mew-pgp-set (vec val) |
| 269 |
(aset vec mew-pgp-ver val)) |
| 270 |
|
| 271 |
|
| 272 |
(defun mew-pgp-debug (label string) |
| 273 |
(when (mew-debug 'pgp) |
| 274 |
(with-current-buffer (get-buffer-create mew-buffer-debug) |
| 275 |
(goto-char (point-max)) |
| 276 |
(insert (format "\n<%s>\n%s\n" label string))))) |
| 277 |
|
| 278 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 279 |
;;; |
| 280 |
;;; PGP version check |
| 281 |
;;; |
| 282 |
|
| 283 |
(defun mew-pgp-setup () |
| 284 |
(cond |
| 285 |
((mew-which-exec mew-prog-pgp) |
| 286 |
(with-temp-buffer |
| 287 |
(mew-call-process-lang mew-prog-pgp nil t nil) |
| 288 |
(goto-char (point-min)) |
| 289 |
(if (search-forward "PGP is now invoked" nil t) |
| 290 |
(setq mew-pgp-ver mew-pgp-ver5) |
| 291 |
(goto-char (point-min)) |
| 292 |
(if (search-forward "Pretty Good Privacy(tm) 2" nil t) |
| 293 |
(setq mew-pgp-ver mew-pgp-ver2) |
| 294 |
(goto-char (point-min)) |
| 295 |
(if (search-forward "Unknown system error" nil t) |
| 296 |
(setq mew-pgp-ver mew-pgp-verg2) |
| 297 |
(goto-char (point-min)) |
| 298 |
(if (search-forward "gpg" nil t) |
| 299 |
(setq mew-pgp-ver mew-pgp-verg) |
| 300 |
(goto-char (point-min)) |
| 301 |
(if (search-forward "Pretty Good Privacy(tm) Version 6" nil t) |
| 302 |
(setq mew-pgp-ver mew-pgp-ver6) |
| 303 |
(setq mew-pgp-ver nil)))))))) |
| 304 |
(t (setq mew-pgp-ver nil)))) |
| 305 |
|
| 306 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 307 |
;;; |
| 308 |
;;; PGP selection |
| 309 |
;;; |
| 310 |
|
| 311 |
(defun mew-pgp-select () |
| 312 |
"Select PGP version and set up environment for selected PGP." |
| 313 |
(interactive) |
| 314 |
(setq mew-prog-pgp |
| 315 |
(completing-read |
| 316 |
"PGP name: " |
| 317 |
(mapcar 'list (list mew-prog-pgp2 mew-prog-pgp5 mew-prog-gpg mew-prog-gpg2)) |
| 318 |
nil t)) |
| 319 |
(mew-pgp-setup)) |
| 320 |
|
| 321 |
;; xxx how about multiple users on local machine? |
| 322 |
(defun mew-pgp-passtag () |
| 323 |
(mew-pgp-get mew-pgp-list)) |
| 324 |
|
| 325 |
(defun mew-pgp-passphrase (&optional again) |
| 326 |
(let ((prompt (if again |
| 327 |
mew-pgp-prompt-reenter-pass |
| 328 |
mew-pgp-prompt-enter-pass)) |
| 329 |
(msg (mew-pgp-passtag))) |
| 330 |
(setq prompt (format prompt msg)) |
| 331 |
(mew-input-passwd prompt msg))) |
| 332 |
|
| 333 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 334 |
;;; |
| 335 |
;;; PGP verifying |
| 336 |
;;; |
| 337 |
|
| 338 |
(defun mew-pgp-verify-check () |
| 339 |
(let (ret keyid) |
| 340 |
(goto-char (point-min)) |
| 341 |
(if (not (re-search-forward (mew-pgp-get mew-pgp-msg-signature) nil t)) |
| 342 |
;; this is verification, so the error is about public key |
| 343 |
(progn |
| 344 |
(goto-char (point-min)) |
| 345 |
(if (search-forward (mew-pgp-get mew-pgp-msg-no-vrfkey) nil t) |
| 346 |
(progn |
| 347 |
(goto-char (point-min)) |
| 348 |
(if (not (re-search-forward (mew-pgp-get mew-pgp-msg-key-id) nil t)) |
| 349 |
(setq keyid "not found") |
| 350 |
(setq keyid (format "0x%s"(mew-match-string 1)))) |
| 351 |
(setq ret (concat mew-pgp-result-pubkey ": ID = " keyid))) |
| 352 |
(if (search-forward (mew-pgp-get mew-pgp-msg-no-keyring) nil t) |
| 353 |
(setq ret mew-pgp-result-pubring) |
| 354 |
(if (re-search-forward (mew-pgp-get mew-pgp-msg-unsupported) nil t) |
| 355 |
(setq ret mew-pgp-result-unsup) |
| 356 |
(if (re-search-forward (mew-pgp-get mew-pgp-msg-nocross) nil t) |
| 357 |
(setq ret mew-pgp-result-nocross) |
| 358 |
;; this line must be nil since this function is used |
| 359 |
;; by the decryption function, too, for signed-then-encrypted |
| 360 |
;; messages. We cannot tell whether or not signatures exist |
| 361 |
;; from the outside of the cipher. |
| 362 |
))))) |
| 363 |
;; Signature result is found. |
| 364 |
(setq ret (concat (mew-match-string 1) " PGP sign ")) |
| 365 |
(goto-char (point-max)) |
| 366 |
(if (and mew-inherit-decode-signer |
| 367 |
(re-search-backward (concat (mew-pgp-get mew-pgp-verify-addr) ".*" mew-inherit-decode-signer) nil t)) |
| 368 |
(progn |
| 369 |
(beginning-of-line) |
| 370 |
(looking-at (concat (mew-pgp-get mew-pgp-verify-addr) "\\(.*\\)")) |
| 371 |
(setq ret (concat ret (mew-match-string 2)))) |
| 372 |
(goto-char (point-max)) |
| 373 |
(re-search-backward (concat (mew-pgp-get mew-pgp-verify-addr) "\\(.*\\)") nil t) |
| 374 |
(setq ret (concat ret (mew-match-string 2)))) |
| 375 |
;; xxx |
| 376 |
(goto-char (point-min)) |
| 377 |
(if (re-search-forward "not certified with \\(enough\\|sufficiently\\)" nil t) |
| 378 |
(setq ret (concat ret " MARGINAL")) |
| 379 |
(goto-char (point-min)) |
| 380 |
(if (search-forward "not trusted" nil t) |
| 381 |
(setq ret (concat ret " UNTRUSTED")) |
| 382 |
(goto-char (point-min)) |
| 383 |
(if (search-forward "not certified with a" nil t) |
| 384 |
;; PGP uses "unknown" for validity internally, but |
| 385 |
;; prints "undefined" instead of "unknown". |
| 386 |
(setq ret (concat ret " UNDEFINED")) |
| 387 |
(goto-char (point-min)) |
| 388 |
(if (search-forward "expired" nil t) |
| 389 |
(setq ret (concat ret " EXPIRED")) |
| 390 |
(setq ret (concat ret " COMPLETE"))))))) |
| 391 |
ret)) |
| 392 |
|
| 393 |
(defun mew-pgp-verify (file1 file2) |
| 394 |
(message "PGP verifying...") |
| 395 |
(let ((ioption (mew-pgp-get mew-prog-pgp-arg-input)) ;; detached signature |
| 396 |
(voptions (mew-pgp-get mew-prog-pgpv-arg)) |
| 397 |
(pgpv (mew-pgp-get mew-prog-pgpv)) |
| 398 |
files ret) |
| 399 |
(with-temp-buffer |
| 400 |
(if ioption |
| 401 |
(setq files (list ioption file1 file2)) |
| 402 |
(setq files (list file2 file1))) |
| 403 |
(apply 'mew-call-process-lang pgpv nil t nil (append voptions files)) |
| 404 |
(setq ret (mew-pgp-verify-check))) |
| 405 |
(message "PGP verifying...done") |
| 406 |
ret)) |
| 407 |
|
| 408 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 409 |
;;; |
| 410 |
;;; PGP encrypting |
| 411 |
;;; |
| 412 |
|
| 413 |
(defun mew-pgp-encrypt-check () |
| 414 |
(let (ret) ;; this should be nil |
| 415 |
(goto-char (point-min)) |
| 416 |
(if (re-search-forward (mew-pgp-get mew-pgp-msg-no-validkey) nil t) |
| 417 |
(setq ret mew-pgp-result-invalid) |
| 418 |
(goto-char (point-min)) |
| 419 |
(if (search-forward (mew-pgp-get mew-pgp-msg-no-enckey) nil t) |
| 420 |
(setq ret mew-pgp-result-pubkey) |
| 421 |
(goto-char (point-min)) |
| 422 |
(if (search-forward (mew-pgp-get mew-pgp-msg-no-keyring) nil t) |
| 423 |
(setq ret mew-pgp-result-pubring) |
| 424 |
(goto-char (point-min)) |
| 425 |
(if (search-forward (mew-pgp-get mew-pgp-msg-pubkey-expired) nil t) |
| 426 |
(setq ret mew-pgp-result-expired))))) |
| 427 |
ret)) |
| 428 |
|
| 429 |
(defun mew-pgp-encrypt (file1 decrypters) |
| 430 |
(message "PGP encrypting...") |
| 431 |
(let ((roption (mew-pgp-get mew-prog-pgp-arg-ruserid)) |
| 432 |
(ooption (mew-pgp-get mew-prog-pgp-arg-output)) |
| 433 |
(eoptions (mew-pgp-get mew-prog-pgpe-arg)) |
| 434 |
(pgpe (mew-pgp-get mew-prog-pgpe)) |
| 435 |
(file2 (mew-make-temp-name)) |
| 436 |
check file3 decs args) ;; not unique if file3 is made here |
| 437 |
(with-temp-buffer |
| 438 |
(insert "Version: 1\n") |
| 439 |
(write-region (point-min) (point-max) file2 nil 'no-msg)) |
| 440 |
(setq file3 (concat (mew-make-temp-name) mew-pgp-ascii-suffix)) |
| 441 |
(if (and mew-encrypt-to-myself |
| 442 |
(not (member mew-inherit-encode-pgp-signer decrypters))) |
| 443 |
(setq decrypters (cons mew-inherit-encode-pgp-signer decrypters))) |
| 444 |
(setq decrypters |
| 445 |
(mapcar (lambda (x) |
| 446 |
(if (string-match "^[^<].*@" x) (concat "<" x ">") x)) |
| 447 |
decrypters)) |
| 448 |
(if (not roption) |
| 449 |
(setq args (append (list ooption file3 file1) eoptions decrypters)) |
| 450 |
(mapc |
| 451 |
(lambda (x) (setq decs (cons roption (cons x decs)))) |
| 452 |
decrypters) |
| 453 |
(setq args (append eoptions decs (list ooption file3 file1)))) |
| 454 |
(with-temp-buffer |
| 455 |
(apply 'mew-call-process-lang pgpe nil t nil args) |
| 456 |
(setq check (mew-pgp-encrypt-check))) |
| 457 |
(message "PGP encrypting...done") |
| 458 |
(list file2 mew-7bit file3 mew-7bit check))) ;; both ctes are 7bit |
| 459 |
|
| 460 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 461 |
;;; |
| 462 |
;;; PGP decrypting |
| 463 |
;;; |
| 464 |
|
| 465 |
(defun mew-pgp-decrypt (_file1 file2) |
| 466 |
;; file1 is a key file. just ignore. |
| 467 |
;; file2 is an encrypted file with PGP. |
| 468 |
(message "PGP decrypting...") |
| 469 |
(setq mew-pgp-running 'decrypting) |
| 470 |
(setq mew-pgp-string nil) |
| 471 |
(setq mew-pgp-decrypt-msg nil) |
| 472 |
(setq mew-pgp-failure nil) |
| 473 |
(let ((process-connection-type mew-connection-type2) |
| 474 |
(ooption (mew-pgp-get mew-prog-pgp-arg-output)) |
| 475 |
(doptions (mew-pgp-get mew-prog-pgpd-arg)) |
| 476 |
(pgpd (mew-pgp-get mew-prog-pgpd)) |
| 477 |
file3 process verify) |
| 478 |
(setq file3 (mew-make-temp-name)) |
| 479 |
(setq process |
| 480 |
(apply 'mew-start-process-lang |
| 481 |
"PGP decrypt" |
| 482 |
(current-buffer) |
| 483 |
pgpd |
| 484 |
(append doptions (list ooption file3 file2)))) |
| 485 |
(mew-set-process-cs process mew-cs-autoconv mew-cs-dummy) |
| 486 |
(set-process-filter process 'mew-pgp-process-filter1) |
| 487 |
(set-process-sentinel process 'mew-pgp-process-sentinel) |
| 488 |
(mew-rendezvous mew-pgp-running) |
| 489 |
(message "PGP decrypting...done") |
| 490 |
(if (file-exists-p file3) |
| 491 |
(progn |
| 492 |
(with-temp-buffer |
| 493 |
(insert mew-pgp-string) |
| 494 |
(setq verify (mew-pgp-verify-check))) |
| 495 |
(when verify |
| 496 |
(setq mew-pgp-decrypt-msg (concat mew-pgp-decrypt-msg "\n\t" verify)))) |
| 497 |
;; unpredictable error |
| 498 |
(mew-passwd-set-passwd (mew-pgp-passtag) nil) |
| 499 |
(if (string= mew-pgp-decrypt-msg mew-pgp-result-sec-succ) |
| 500 |
(setq mew-pgp-decrypt-msg mew-pgp-result-dec-fail))) |
| 501 |
(list file3 mew-pgp-decrypt-msg))) |
| 502 |
|
| 503 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 504 |
;;; |
| 505 |
;;; PGP signing |
| 506 |
;;; |
| 507 |
|
| 508 |
(defun mew-pgp-canonicalize () |
| 509 |
(save-excursion |
| 510 |
(goto-char (point-min)) |
| 511 |
(while (re-search-forward "[ \t]+$" nil t) |
| 512 |
(replace-match "" nil t) |
| 513 |
(forward-line)))) |
| 514 |
|
| 515 |
(defun mew-pgp-get-micalg () |
| 516 |
(let ((micalg (mew-pgp-get mew-pgp-micalg)) alg) |
| 517 |
(if (and (/= mew-pgp-ver mew-pgp-verg) |
| 518 |
(/= mew-pgp-ver mew-pgp-verg2)) |
| 519 |
micalg |
| 520 |
(with-temp-buffer |
| 521 |
(insert mew-pgp-string) |
| 522 |
(goto-char (point-min)) |
| 523 |
(if (re-search-forward "SIG_CREATED [A-Z] [0-9]+ \\([0-9]+\\)" nil t) |
| 524 |
(setq alg (cdr (assoc (mew-match-string 1) mew-pgp-hash-alist))))) |
| 525 |
(or alg micalg)))) |
| 526 |
|
| 527 |
(defun mew-pgp-sign (file1) |
| 528 |
(message "PGP signing...") |
| 529 |
(setq mew-pgp-running 'signing) |
| 530 |
(setq mew-pgp-string nil) |
| 531 |
(setq mew-pgp-sign-msg nil) |
| 532 |
(setq mew-pgp-failure nil) |
| 533 |
(let ((process-connection-type mew-connection-type2) |
| 534 |
(loption (mew-pgp-get mew-prog-pgp-arg-luserid)) |
| 535 |
(ooption (mew-pgp-get mew-prog-pgp-arg-output)) |
| 536 |
(soptions (mew-pgp-get mew-prog-pgps-arg)) |
| 537 |
(pgps (mew-pgp-get mew-prog-pgps)) |
| 538 |
file2 process) |
| 539 |
(setq file2 (concat (mew-make-temp-name) mew-pgp-ascii-suffix)) |
| 540 |
;; not perfectly unique but OK |
| 541 |
(setq process |
| 542 |
(apply 'mew-start-process-lang |
| 543 |
"PGP sign" |
| 544 |
(current-buffer) ;; xxx nil? |
| 545 |
pgps |
| 546 |
(append soptions (list loption mew-inherit-encode-pgp-signer ooption file2 file1)))) |
| 547 |
(mew-set-process-cs process mew-cs-autoconv mew-cs-dummy) |
| 548 |
(set-process-filter process 'mew-pgp-process-filter1) |
| 549 |
(set-process-sentinel process 'mew-pgp-process-sentinel) |
| 550 |
(mew-rendezvous mew-pgp-running) |
| 551 |
(message "PGP signing...done") |
| 552 |
(unless (file-exists-p file2) ;; for unpredictable error |
| 553 |
(mew-passwd-set-passwd (mew-pgp-passtag) nil)) |
| 554 |
(list file2 nil (mew-pgp-get-micalg) mew-pgp-sign-msg))) ;; return |
| 555 |
|
| 556 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 557 |
;;; |
| 558 |
;;; PGP process functions |
| 559 |
;;; |
| 560 |
|
| 561 |
(defun mew-pgp-process-sentinel (_process _event) |
| 562 |
(save-excursion |
| 563 |
(let ((decrypted mew-pgp-result-sec-succ) |
| 564 |
(msg "")) |
| 565 |
(if (not mew-pgp-failure) |
| 566 |
(cond |
| 567 |
((eq mew-pgp-running 'decrypting) |
| 568 |
(setq mew-pgp-decrypt-msg decrypted)) |
| 569 |
((eq mew-pgp-running 'signing) |
| 570 |
(setq mew-pgp-sign-msg nil))) |
| 571 |
(cond |
| 572 |
;; sign or decrypt |
| 573 |
((eq mew-pgp-failure mew-pgp-err-pass) |
| 574 |
(setq msg mew-pgp-result-pass)) |
| 575 |
;; decrypt-then-verify |
| 576 |
((eq mew-pgp-failure mew-pgp-err-pubring) |
| 577 |
(setq msg decrypted)) |
| 578 |
;; decrypt-then-verify |
| 579 |
((eq mew-pgp-failure mew-pgp-err-pubkey) |
| 580 |
(setq msg decrypted)) |
| 581 |
;; sign |
| 582 |
((eq mew-pgp-failure mew-pgp-err-secring) |
| 583 |
(setq msg mew-pgp-result-secring)) |
| 584 |
;; sign |
| 585 |
((eq mew-pgp-failure mew-pgp-err-seckey) |
| 586 |
(setq msg mew-pgp-result-seckey)) |
| 587 |
;; decrypt |
| 588 |
((eq mew-pgp-failure mew-pgp-err-seckey-or-secring) |
| 589 |
(setq msg mew-pgp-result-seckey-or-secring)) |
| 590 |
;; other |
| 591 |
(t ;; mew-pgp-err-other or nil |
| 592 |
(setq msg mew-pgp-result-other))) |
| 593 |
(cond |
| 594 |
((eq mew-pgp-running 'decrypting) |
| 595 |
(setq mew-pgp-decrypt-msg msg)) |
| 596 |
((eq mew-pgp-running 'signing) |
| 597 |
(setq mew-pgp-sign-msg msg)))) |
| 598 |
(setq mew-pgp-running nil)))) |
| 599 |
|
| 600 |
(defun mew-pgp-process-filter1 (process string) |
| 601 |
(save-excursion |
| 602 |
;; sign or decrypt, not verify |
| 603 |
(mew-pgp-debug "PGP filter1" string) |
| 604 |
(setq mew-pgp-string (concat mew-pgp-string string)) |
| 605 |
(cond |
| 606 |
;; no secret key or no secring for decrypt |
| 607 |
((string-match (mew-pgp-get mew-pgp-msg-no-seckey-or-secring) string) |
| 608 |
(setq mew-pgp-failure mew-pgp-err-seckey-or-secring) |
| 609 |
(set-process-filter process 'mew-pgp-process-filter3)) |
| 610 |
|
| 611 |
;; no secring for sign |
| 612 |
((string-match (mew-pgp-get mew-pgp-msg-no-keyring) string) |
| 613 |
(setq mew-pgp-failure mew-pgp-err-secring) |
| 614 |
;; Enter secret key filename: |
| 615 |
(process-send-string process "\n") |
| 616 |
(set-process-filter process 'mew-pgp-process-filter3)) |
| 617 |
|
| 618 |
;; no secret key for sign |
| 619 |
((string-match (mew-pgp-get mew-pgp-msg-no-enckey) string) |
| 620 |
(setq mew-pgp-failure mew-pgp-err-seckey) |
| 621 |
;; Enter secret key filename: |
| 622 |
(process-send-string process "\n") |
| 623 |
(set-process-filter process 'mew-pgp-process-filter3)) |
| 624 |
|
| 625 |
;; pass phrase for sign or decrypt |
| 626 |
((string-match (mew-pgp-get mew-pgp-msg-enter-pass) string) |
| 627 |
(process-send-string process (format "%s\n" (mew-pgp-passphrase))) |
| 628 |
(set-process-filter process 'mew-pgp-process-filter2)) |
| 629 |
|
| 630 |
;; overwrite a previous data with a new data. (multiple data is unsupported) |
| 631 |
((string-match (mew-pgp-get mew-pgp-msg-overwrite) string) |
| 632 |
(process-send-string process "y\n") |
| 633 |
(set-process-filter process 'mew-pgp-process-filter1)) |
| 634 |
|
| 635 |
;; just in case |
| 636 |
((string-match (mew-pgp-get mew-pgp-msg-enter) string) |
| 637 |
(setq mew-pgp-failure mew-pgp-err-other) |
| 638 |
;; Enter PSWD: |
| 639 |
(process-send-string process "\n") |
| 640 |
(set-process-filter process 'mew-pgp-process-filter3))))) |
| 641 |
|
| 642 |
(defun mew-pgp-process-filter2 (process string) |
| 643 |
(save-excursion |
| 644 |
(mew-pgp-debug "PGP filter2" string) |
| 645 |
(setq mew-pgp-string (concat mew-pgp-string string)) |
| 646 |
(cond |
| 647 |
;; re-enter pass phrase |
| 648 |
((string-match (mew-pgp-get mew-pgp-msg-reenter-pass) string) |
| 649 |
(setq mew-pgp-string nil) |
| 650 |
(mew-passwd-set-passwd (mew-pgp-passtag) nil) ;; cancel anyway |
| 651 |
(process-send-string process (format "%s\n" (mew-pgp-passphrase 'again))) |
| 652 |
(set-process-filter process 'mew-pgp-process-filter2)) |
| 653 |
|
| 654 |
;; pass phrases were wrong three times |
| 655 |
((string-match (mew-pgp-get mew-pgp-msg-bad-pass) string) |
| 656 |
(setq mew-pgp-failure mew-pgp-err-pass) |
| 657 |
(mew-passwd-set-passwd (mew-pgp-passtag) nil) ;; cancel anyway |
| 658 |
(set-process-filter process 'mew-pgp-process-filter3)) |
| 659 |
|
| 660 |
;; no pubring for verify |
| 661 |
((string-match (mew-pgp-get mew-pgp-msg-no-keyring) string) |
| 662 |
(setq mew-pgp-failure mew-pgp-err-pubring) |
| 663 |
;; Enter public key filename: |
| 664 |
(process-send-string process "\n") |
| 665 |
(set-process-filter process 'mew-pgp-process-filter3)) |
| 666 |
|
| 667 |
;; no public key for verify |
| 668 |
((string-match (mew-pgp-get mew-pgp-msg-no-vrfkey) string) |
| 669 |
(setq mew-pgp-failure mew-pgp-err-pubkey) |
| 670 |
;; Enter public key filename: |
| 671 |
(process-send-string process "\n") |
| 672 |
(set-process-filter process 'mew-pgp-process-filter3)) |
| 673 |
|
| 674 |
;; after decrypted secret key, symmetric key is not unknown... |
| 675 |
;; gpg: unknown cipher algorithm |
| 676 |
;; no secret key or no secring for decrypt |
| 677 |
((string-match (mew-pgp-get mew-pgp-msg-no-seckey-or-secring) string) |
| 678 |
(setq mew-pgp-failure mew-pgp-err-seckey-or-secring) |
| 679 |
(set-process-filter process 'mew-pgp-process-filter3)) |
| 680 |
|
| 681 |
;; overwrite a previous data with a new data. (multiple data is unsupported) |
| 682 |
((string-match (mew-pgp-get mew-pgp-msg-overwrite) string) |
| 683 |
(process-send-string process "y\n") |
| 684 |
(set-process-filter process 'mew-pgp-process-filter2)) |
| 685 |
|
| 686 |
;; just in case |
| 687 |
((string-match (mew-pgp-get mew-pgp-msg-enter) string) |
| 688 |
(setq mew-pgp-failure mew-pgp-err-other) |
| 689 |
;; Enter PSWD: |
| 690 |
(process-send-string process "\n") |
| 691 |
(set-process-filter process 'mew-pgp-process-filter3))))) |
| 692 |
|
| 693 |
(defun mew-pgp-process-filter3 (process string) |
| 694 |
(save-excursion |
| 695 |
(mew-pgp-debug "PGP filter3" string) |
| 696 |
;; ending or error |
| 697 |
(setq mew-pgp-string (concat mew-pgp-string string)) |
| 698 |
;; string may contain old "Enter" |
| 699 |
(cond |
| 700 |
;; just in case |
| 701 |
((string-match (mew-pgp-get mew-pgp-msg-enter) string) |
| 702 |
;; (setq mew-pgp-failure mew-pgp-err-other) ;; this is wrong |
| 703 |
;; Enter PSWD: |
| 704 |
(process-send-string process "\n") |
| 705 |
(set-process-filter process 'mew-pgp-process-filter3))))) |
| 706 |
|
| 707 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 708 |
;;; |
| 709 |
;;; shortcut methods |
| 710 |
;;; |
| 711 |
|
| 712 |
(defun mew-pgp-sign-message (&optional arg) |
| 713 |
"Sign the entire draft with PGP. Input your passphrase." |
| 714 |
(interactive "P") |
| 715 |
(mew-pgp-encode-message 'pgp-signature arg)) |
| 716 |
|
| 717 |
(defun mew-pgp-encrypt-message () |
| 718 |
"Encrypt the entire draft with PGP." |
| 719 |
(interactive) |
| 720 |
(mew-pgp-encode-message 'pgp-encryption)) |
| 721 |
|
| 722 |
(defun mew-pgp-sign-encrypt-message (&optional _arg) |
| 723 |
"Sign then encrypt the entire draft with PGP. Input your passphrase." |
| 724 |
(interactive "P") |
| 725 |
(mew-pgp-encode-message 'pgp-signature-encryption)) |
| 726 |
|
| 727 |
(defun mew-pgp-encrypt-sign-message (&optional _arg) |
| 728 |
"Encrypt then sign the entire draft with PGP. Input your passphrase." |
| 729 |
(interactive "P") |
| 730 |
(mew-pgp-encode-message 'pgp-encryption-signature)) |
| 731 |
|
| 732 |
(defun mew-pgp-encode-message (type &optional ask-signer) |
| 733 |
(if (null mew-pgp-ver) |
| 734 |
(message "%s does not exist" mew-prog-pgp) |
| 735 |
(let ((func 'mew-draft-make-message)) |
| 736 |
(if (mew-use-old-pgp (mew-tinfo-get-case)) |
| 737 |
(setq func 'mew-old-pgp-encode)) |
| 738 |
(if (and ask-signer (string-match "signature" (symbol-name type))) |
| 739 |
(funcall func type (car (mew-input-address "Who's key?: "))) |
| 740 |
(funcall func type))))) |
| 741 |
|
| 742 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 743 |
;;; |
| 744 |
;;; old PGP encoding |
| 745 |
;;; |
| 746 |
|
| 747 |
(defconst mew-prog-old-pgps-arg |
| 748 |
'(("-sat" "+clearsig=on" "+language=en" "+batchmode=off") |
| 749 |
("-at" "+clearsig=on" "+language=en" "+batchmode=off") |
| 750 |
("-sat" "+clearsig=on" "+language=en" "+batchmode=off") |
| 751 |
("--clearsign" "--armor" "--textmode" "--status-fd" "1") |
| 752 |
("--clearsign" "--armor" "--textmode" "--status-fd" "1" "--command-fd" "0" "--no-tty" "--yes"))) |
| 753 |
|
| 754 |
(defconst mew-prog-old-pgpse-arg |
| 755 |
'(("-seat" "+language=en" "+batchmode=off") |
| 756 |
("-eat" "+language=en" "+batchmode=off") |
| 757 |
("-seat" "+language=en" "+batchmode=off") |
| 758 |
("--sign" "--encrypt" "--armor" "--textmode") |
| 759 |
("--sign" "--encrypt" "--armor" "--textmode"))) |
| 760 |
|
| 761 |
(defconst mew-prog-old-pgpe-arg |
| 762 |
'(("-eat" "+language=en" "+batchmode=on" "+armorlines=0") |
| 763 |
("-at" "+language=en" "+batchmode=on" "+armorlines=0") |
| 764 |
("-eat" "+language=en" "+batchmode=on" "+armorlines=0") |
| 765 |
("--encrypt" "--armor" "--textmode" "--batch") |
| 766 |
("--encrypt" "--armor" "--textmode" "--batch"))) |
| 767 |
|
| 768 |
(defun mew-old-pgp-encode (type &optional signer) |
| 769 |
(let (mew-inherit-encode-pgp-signer doit syntax ctl ct charset cs) |
| 770 |
(if (mew-attach-p) |
| 771 |
(if (mew-encode-syntax-have-one-part) |
| 772 |
(progn |
| 773 |
(setq syntax (mew-syntax-get-part mew-encode-syntax)) |
| 774 |
(setq ctl (mew-syntax-get-ct syntax)) |
| 775 |
(setq ct (mew-syntax-get-value ctl 'cap)) |
| 776 |
(if (string= ct mew-ct-txt) |
| 777 |
(progn |
| 778 |
(setq charset (mew-syntax-get-param ctl "charset")) |
| 779 |
(setq cs (mew-charset-to-cs charset)) |
| 780 |
(setq doit t) |
| 781 |
(mew-attach-clear)) |
| 782 |
(message "Old PGP cannot be used for non-text"))) |
| 783 |
(message "Old PGP cannot be used if multipart exists")) |
| 784 |
(setq doit t)) |
| 785 |
(when doit |
| 786 |
(setq mew-inherit-encode-pgp-signer (or signer |
| 787 |
(mew-pgp-signer (mew-tinfo-get-case)) |
| 788 |
(mew-get-my-address))) |
| 789 |
(cond |
| 790 |
((eq type 'pgp-signature) |
| 791 |
(mew-old-pgp-sign cs syntax)) |
| 792 |
((eq type 'pgp-encryption) |
| 793 |
(mew-old-pgp-encrypt cs)) |
| 794 |
((eq type 'pgp-signature-encryption) |
| 795 |
(mew-pgp-old-sign-encrypt cs)) |
| 796 |
(t |
| 797 |
(message "Not supported")))))) |
| 798 |
|
| 799 |
(defun mew-old-pgp-sign (cs &optional syntax) |
| 800 |
(let ((file1 (mew-make-temp-name)) |
| 801 |
(mew-prog-pgps-arg mew-prog-old-pgps-arg) |
| 802 |
file2 fmc errmsg charset) |
| 803 |
(goto-char (mew-header-end)) |
| 804 |
(forward-line) |
| 805 |
(unless cs |
| 806 |
(setq charset (mew-charset-guess-region (point) (point-max))) |
| 807 |
(setq cs (mew-charset-to-cs charset))) |
| 808 |
(mew-frwlet mew-cs-dummy cs |
| 809 |
(write-region (point) (point-max) file1 nil 'no-msg)) |
| 810 |
(condition-case nil |
| 811 |
(setq fmc (mew-pgp-sign file1)) |
| 812 |
(error |
| 813 |
(mew-delete-file file1) |
| 814 |
(mew-encode-error |
| 815 |
(format "unknown error for %s. Check %s, anyway" |
| 816 |
mew-ct-mls mew-temp-dir)))) |
| 817 |
(mew-set '(file2 nil nil errmsg) fmc) |
| 818 |
(if errmsg |
| 819 |
(progn |
| 820 |
(mew-delete-file file1) |
| 821 |
(mew-delete-file file2) |
| 822 |
(error errmsg)) |
| 823 |
(delete-region (point) (point-max)) |
| 824 |
(mew-frwlet cs mew-cs-dummy |
| 825 |
(insert-file-contents file2)) |
| 826 |
(mew-delete-file file1) |
| 827 |
(mew-delete-file file2) |
| 828 |
(setq mew-encode-syntax syntax) |
| 829 |
(mew-draft-make-message)))) |
| 830 |
|
| 831 |
(defun mew-old-pgp-encrypt (cs) |
| 832 |
(let ((file1 (mew-make-temp-name)) |
| 833 |
(mew-prog-pgps-arg mew-prog-old-pgps-arg) |
| 834 |
(decrypters (mew-header-parse-address-list mew-destination:-list)) |
| 835 |
file2 file3 fc errmsg charset) |
| 836 |
(goto-char (mew-header-end)) |
| 837 |
(forward-line) |
| 838 |
(unless cs |
| 839 |
(setq charset (mew-charset-guess-region (point) (point-max))) |
| 840 |
(setq cs (mew-charset-to-cs charset))) |
| 841 |
(mew-frwlet mew-cs-dummy cs |
| 842 |
(write-region (point) (point-max) file1 nil 'no-msg)) |
| 843 |
(condition-case nil |
| 844 |
(setq fc (mew-pgp-encrypt file1 decrypters)) |
| 845 |
(error |
| 846 |
(mew-delete-file file1) |
| 847 |
(mew-encode-error |
| 848 |
(format "unknown error for %s. Check %s, anyway" |
| 849 |
mew-ct-mle mew-temp-dir)))) |
| 850 |
(mew-set '(file2 nil file3 nil errmsg) fc) |
| 851 |
(if errmsg |
| 852 |
(progn |
| 853 |
(mew-delete-file file1) |
| 854 |
(mew-delete-file file2) |
| 855 |
(mew-delete-file file3) |
| 856 |
(error errmsg)) |
| 857 |
;; Create multipart content-header |
| 858 |
(delete-region (point) (point-max)) |
| 859 |
(mew-frwlet cs mew-cs-dummy |
| 860 |
(insert-file-contents file3)) |
| 861 |
(mew-delete-file file1) |
| 862 |
(mew-delete-file file2) |
| 863 |
(mew-delete-file file3) |
| 864 |
(setq mew-encode-syntax nil) |
| 865 |
(mew-draft-make-message)))) |
| 866 |
|
| 867 |
(defun mew-pgp-old-sign-encrypt (cs) |
| 868 |
(message "PGP signing then encrypting...") |
| 869 |
(let ((decrypters (mew-header-parse-address-list mew-destination:-list)) |
| 870 |
(roption (mew-pgp-get mew-prog-pgp-arg-ruserid)) |
| 871 |
(loption (mew-pgp-get mew-prog-pgp-arg-luserid)) |
| 872 |
(ooption (mew-pgp-get mew-prog-pgp-arg-output)) |
| 873 |
(eoptions (mew-pgp-get mew-prog-old-pgpse-arg)) ;; xxx |
| 874 |
(pgpe (mew-pgp-get mew-prog-pgpe)) ;; xxx |
| 875 |
(file1 (mew-make-temp-name)) |
| 876 |
file2 check decs args process charset) |
| 877 |
(goto-char (mew-header-end)) |
| 878 |
(forward-line) |
| 879 |
(unless cs |
| 880 |
(setq charset (mew-charset-guess-region (point) (point-max))) |
| 881 |
(setq cs (mew-charset-to-cs charset))) |
| 882 |
(mew-frwlet mew-cs-dummy cs |
| 883 |
(write-region (point) (point-max) file1 nil 'no-msg)) |
| 884 |
(if (and mew-encrypt-to-myself |
| 885 |
(not (member mew-inherit-encode-pgp-signer decrypters))) |
| 886 |
(setq decrypters (cons mew-inherit-encode-pgp-signer decrypters))) |
| 887 |
(setq decrypters |
| 888 |
(mapcar (lambda (x) |
| 889 |
(if (string-match "^[^<].*@" x) (concat "<" x ">") x)) |
| 890 |
decrypters)) |
| 891 |
(setq file2 (mew-make-temp-name)) |
| 892 |
(setq args (list loption mew-inherit-encode-pgp-signer ooption file2 file1)) |
| 893 |
(if (not roption) |
| 894 |
(setq args (append args eoptions decrypters)) |
| 895 |
(dolist (decrypter decrypters) |
| 896 |
;; nreverse later, take care. |
| 897 |
(setq decs (cons decrypter (cons roption decs)))) |
| 898 |
(setq decrypters (nreverse decs)) |
| 899 |
(setq args (append eoptions decrypters args))) |
| 900 |
(setq mew-pgp-running 'signing) |
| 901 |
(setq mew-pgp-string nil) |
| 902 |
(setq mew-pgp-sign-msg nil) |
| 903 |
(setq mew-pgp-failure nil) |
| 904 |
(with-temp-buffer |
| 905 |
(setq process (apply 'mew-start-process-lang |
| 906 |
"PGP sign" |
| 907 |
(current-buffer) |
| 908 |
pgpe args)) |
| 909 |
(mew-set-process-cs process mew-cs-autoconv mew-cs-dummy) |
| 910 |
(set-process-filter process 'mew-pgp-process-filter1) |
| 911 |
(set-process-sentinel process 'mew-pgp-process-sentinel) |
| 912 |
(mew-rendezvous mew-pgp-running) |
| 913 |
(message "PGP signing then encrypting...done") |
| 914 |
(setq check (mew-pgp-encrypt-check))) |
| 915 |
(unless (file-exists-p file2) ;; for unpredictable error |
| 916 |
(mew-passwd-set-passwd (mew-pgp-passtag) nil)) |
| 917 |
(if (or mew-pgp-sign-msg check) |
| 918 |
(progn |
| 919 |
(mew-delete-file file1) |
| 920 |
(mew-delete-file file2) |
| 921 |
(error (or mew-pgp-sign-msg check))) |
| 922 |
(delete-region (point) (point-max)) |
| 923 |
(mew-frwlet cs mew-cs-dummy |
| 924 |
(insert-file-contents file2)) |
| 925 |
(mew-delete-file file1) |
| 926 |
(mew-delete-file file2) |
| 927 |
(setq mew-encode-syntax nil) |
| 928 |
(mew-draft-make-message)))) |
| 929 |
|
| 930 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 931 |
;;; |
| 932 |
;;; old PGP decoding |
| 933 |
;;; |
| 934 |
|
| 935 |
(defun mew-old-pgp-check () |
| 936 |
(goto-char (point-min)) |
| 937 |
(if (re-search-forward (concat "^" mew-pgp-encryption-begin) nil t) |
| 938 |
;; this may be 'pgp-signature, but we hope clearsig is used... |
| 939 |
'pgp-encryption |
| 940 |
(goto-char (point-min)) |
| 941 |
(if (re-search-forward (concat "^" mew-pgp-signature-begin) nil t) |
| 942 |
'pgp-signature |
| 943 |
nil))) |
| 944 |
|
| 945 |
(defun mew-old-pgp-verify (file) |
| 946 |
(message "PGP verifying...") |
| 947 |
(let ((voptions (mew-pgp-get mew-prog-old-pgpv-arg)) |
| 948 |
(ooption (mew-pgp-get mew-prog-pgp-arg-output)) |
| 949 |
(pgpv (mew-pgp-get mew-prog-pgpv)) |
| 950 |
(file1 (mew-make-temp-name)) |
| 951 |
verify) |
| 952 |
(with-temp-buffer |
| 953 |
(apply 'mew-call-process-lang |
| 954 |
pgpv nil t nil (append voptions (list ooption file1 file))) |
| 955 |
(setq verify (mew-pgp-verify-check))) |
| 956 |
(message "PGP verifying...done") |
| 957 |
(list file1 verify))) |
| 958 |
|
| 959 |
(defun mew-summary-decode-old-pgp () |
| 960 |
"Decrypting/verifying old-fashioned PGP messages." |
| 961 |
(interactive) |
| 962 |
(if (null mew-pgp-ver) |
| 963 |
(message "%s does not exist" mew-prog-pgp) |
| 964 |
(mew-summary-msg |
| 965 |
(let ((fld (mew-summary-folder-name)) |
| 966 |
(msg (mew-summary-message-number2)) |
| 967 |
type) |
| 968 |
(with-current-buffer (mew-buffer-message) |
| 969 |
;; We need MIME-decoded buffer to check PGP boundaries. |
| 970 |
(setq type (mew-old-pgp-check)) |
| 971 |
(if type |
| 972 |
(mew-old-pgp-decode fld msg type) |
| 973 |
(message "No PGP data found"))))))) |
| 974 |
|
| 975 |
(defun mew-old-pgp-decode (fld msg type) |
| 976 |
;; in Message buffer |
| 977 |
(let* ((cache (mew-cache-hit fld msg 'must-hit)) |
| 978 |
(syntax (mew-cache-decode-syntax cache)) |
| 979 |
(file (mew-expand-msg fld msg)) |
| 980 |
mew-inherit-decode-signer |
| 981 |
file1 file2 result xmew win start cte) |
| 982 |
(with-temp-buffer |
| 983 |
(mew-frwlet mew-cs-text-for-read mew-cs-text-for-write |
| 984 |
(mew-insert-file-contents file) |
| 985 |
(re-search-forward mew-eoh nil t) |
| 986 |
(forward-line) |
| 987 |
(delete-region (point-min) (point)) |
| 988 |
(when (eq type 'pgp-signature) |
| 989 |
(setq cte (mew-syntax-get-cte (mew-syntax-get-part syntax))) |
| 990 |
(mew-decode-mime-body nil mew-ct-txt cte)) |
| 991 |
(setq file1 (mew-make-temp-name)) |
| 992 |
(write-region (point-min) (point-max) file1 nil 'no-msg))) |
| 993 |
(mew-elet |
| 994 |
(widen) |
| 995 |
(setq win (get-buffer-window (current-buffer))) |
| 996 |
(setq start (window-start win)) |
| 997 |
(setq mew-inherit-decode-signer |
| 998 |
(mew-addrstr-parse-address |
| 999 |
(mew-header-get-value mew-from:))) |
| 1000 |
(goto-char (mew-header-end)) |
| 1001 |
(forward-line) |
| 1002 |
(delete-region (point) (point-max)) |
| 1003 |
(cond |
| 1004 |
((eq type 'pgp-encryption) |
| 1005 |
(setq result (mew-pgp-decrypt 'dummy file1))) |
| 1006 |
((eq type 'pgp-signature) |
| 1007 |
(setq result (mew-old-pgp-verify file1)))) |
| 1008 |
(mew-set '(file2 xmew) result) |
| 1009 |
(unless xmew (setq xmew "CRC error")) ;; xxx |
| 1010 |
(mew-xinfo-set-pri-result |
| 1011 |
(concat mew-x-mew: " <body> " xmew "\n")) |
| 1012 |
(save-excursion |
| 1013 |
(mew-header-delete-lines (list mew-x-mew:)) |
| 1014 |
(goto-char (mew-header-end)) |
| 1015 |
(mew-decode-syntax-insert-privacy)) |
| 1016 |
(when (and file1 (file-exists-p file1)) |
| 1017 |
(mew-delete-file file1)) |
| 1018 |
(when (and file2 (file-exists-p file2)) |
| 1019 |
(mew-frwlet mew-cs-text-for-read mew-cs-dummy |
| 1020 |
(mew-insert-file-contents file2)) |
| 1021 |
(mew-delete-file file2)) |
| 1022 |
(mew-cs-decode-region |
| 1023 |
(point) (point-max) |
| 1024 |
;; This is valid for PGP signature only. |
| 1025 |
;; Since cipher text is encoded with Radix 64, charset should |
| 1026 |
;; be "US-ASCII". I don't know this code is valid for |
| 1027 |
;; cipher text in the case that a wrong charset is specified. |
| 1028 |
(or (mew-charset-to-cs |
| 1029 |
(mew-syntax-get-param |
| 1030 |
(mew-syntax-get-ct (mew-syntax-get-part syntax)) "charset")) |
| 1031 |
mew-cs-autoconv)) |
| 1032 |
(mew-highlight-body-region (point) (point-max)) |
| 1033 |
(mew-message-set-end-of) |
| 1034 |
(set-window-start win start) |
| 1035 |
(set-buffer-modified-p nil)))) |
| 1036 |
|
| 1037 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 1038 |
;;; |
| 1039 |
;;; Key distribution |
| 1040 |
;;; |
| 1041 |
|
| 1042 |
(defun mew-attach-pgp-public-key () |
| 1043 |
"Extract the PGP key for the specified user on '.'. in attachments" |
| 1044 |
(interactive) |
| 1045 |
(if (not (mew-attach-not-line012-1)) |
| 1046 |
(message "Cannot link here") |
| 1047 |
(let* ((error nil) |
| 1048 |
(nums (mew-syntax-nums)) |
| 1049 |
(subdir (mew-attach-expand-path mew-encode-syntax nums)) |
| 1050 |
(attachdir (mew-attachdir)) |
| 1051 |
user file filepath begin end) |
| 1052 |
;; attachdir / {subdir/} dir |
| 1053 |
(unless (string= subdir "") |
| 1054 |
(setq attachdir (expand-file-name subdir attachdir))) |
| 1055 |
;; attachdir / file |
| 1056 |
(setq filepath (mew-random-filename attachdir 1 nil mew-pgp-key-suffix)) |
| 1057 |
(if (null filepath) |
| 1058 |
(message "Cannot make a file for pgp key, sorry") |
| 1059 |
(setq file (file-name-nondirectory filepath)) |
| 1060 |
(setq user (car (mew-input-address |
| 1061 |
"Who's key? (%s): " (mew-get-my-address)))) |
| 1062 |
(if (string-match "^[^<].*@" user) (setq user (concat "<" user ">"))) |
| 1063 |
(with-temp-buffer |
| 1064 |
(apply 'mew-call-process-lang |
| 1065 |
(mew-pgp-get mew-prog-pgpk) |
| 1066 |
nil t nil |
| 1067 |
(append |
| 1068 |
(mew-pgp-get mew-prog-pgpk-ext-arg) |
| 1069 |
(list user))) |
| 1070 |
(goto-char (point-min)) |
| 1071 |
(if (search-forward (mew-pgp-get mew-pgp-msg-no-export-key) nil t) |
| 1072 |
(setq error t) |
| 1073 |
(goto-char (point-min)) |
| 1074 |
(if (not (search-forward mew-pgp-key-begin nil t)) |
| 1075 |
(setq error t) |
| 1076 |
(beginning-of-line) |
| 1077 |
(setq begin (point)) |
| 1078 |
(if (not (search-forward mew-pgp-key-end nil t)) |
| 1079 |
(setq error t) |
| 1080 |
(beginning-of-line) |
| 1081 |
(forward-line) |
| 1082 |
(setq end (point))) |
| 1083 |
(write-region begin end filepath nil 'no-msg)))) |
| 1084 |
(if error |
| 1085 |
(message "Cannot extract pgp key for %s" user) |
| 1086 |
(setq mew-encode-syntax |
| 1087 |
(mew-syntax-insert-entry |
| 1088 |
mew-encode-syntax |
| 1089 |
nums |
| 1090 |
(mew-encode-syntax-single file mew-type-apk nil user))) |
| 1091 |
(mew-encode-syntax-print mew-encode-syntax)))))) |
| 1092 |
|
| 1093 |
(defvar mew-pgp-tmp-file nil) |
| 1094 |
|
| 1095 |
(defun mew-mime-pgp-keys (_cache _begin _end &optional _params) |
| 1096 |
"A function to add PGP keys in Application/PGP-Keys to your |
| 1097 |
public keyring." |
| 1098 |
(mew-elet |
| 1099 |
(insert " ###### ##### ###### # # ####### # #\n" |
| 1100 |
" # # # # # # # # # # #\n" |
| 1101 |
" # # # # # # # # # #\n" |
| 1102 |
" ###### # #### ###### #### ####### #\n" |
| 1103 |
" # # # # # # # #\n" |
| 1104 |
" # # # # # # # #\n" |
| 1105 |
" # ##### # # # ####### #\n" |
| 1106 |
"\n\n") |
| 1107 |
(mew-insert-manual |
| 1108 |
"To add this key to your pubring, type " |
| 1109 |
"'\\<mew-summary-mode-map>\\[mew-summary-execute-external]'.\n"))) |
| 1110 |
|
| 1111 |
(defun mew-mime-pgp-keys-ext (cache begin end &optional _params) |
| 1112 |
"A function to add PGP keys to your public keyring." |
| 1113 |
(if (not mew-pgp-ver) |
| 1114 |
(message "PGP not found") |
| 1115 |
(when (y-or-n-p "Add this PGP key onto your public keyring? ") |
| 1116 |
(setq mew-pgp-tmp-file (mew-make-temp-name)) |
| 1117 |
(with-current-buffer cache |
| 1118 |
(mew-frwlet mew-cs-dummy mew-cs-autoconv |
| 1119 |
(write-region begin end mew-pgp-tmp-file nil 'no-msg)) |
| 1120 |
(set-buffer (mew-buffer-message)) |
| 1121 |
(mew-elet |
| 1122 |
(message "Adding PGP keys...") |
| 1123 |
(apply 'mew-call-process-lang |
| 1124 |
(mew-pgp-get mew-prog-pgpk) |
| 1125 |
nil t nil |
| 1126 |
(append (mew-pgp-get mew-prog-pgpk-add-arg) |
| 1127 |
(list mew-pgp-tmp-file))) |
| 1128 |
(message "Adding PGP keys...done") |
| 1129 |
(insert "\n\n" |
| 1130 |
"**************** IMPORTANT NOTE ****************\n" |
| 1131 |
"When Mew adds PGP keys onto your public keyring,\n" |
| 1132 |
"it is careless about both TRUST and VALIDITY.\n" |
| 1133 |
"It is YOU who set these values. Please use\n") |
| 1134 |
(cond |
| 1135 |
((eq mew-pgp-ver mew-pgp-ver2) |
| 1136 |
(insert "\"pgp -ke\" and \"pgp -ks\" to change them.\n")) |
| 1137 |
((eq mew-pgp-ver mew-pgp-ver5) |
| 1138 |
(insert "\"pgpk -e\" and \"pgpk -s\" to change them.\n")) |
| 1139 |
((eq mew-pgp-ver mew-pgp-ver6) |
| 1140 |
(insert "\"pgp -ke\" and \"pgp -ks\" to change them.\n")) |
| 1141 |
((eq mew-pgp-ver mew-pgp-verg) |
| 1142 |
(insert "\"gpg --edit-key\" to change them.\n")) |
| 1143 |
((eq mew-pgp-ver mew-pgp-verg2) |
| 1144 |
(insert "\"gpg --edit-key\" to change them.\n"))) |
| 1145 |
(insert "If you do not know what TRUST and VALIDITY is,\n" |
| 1146 |
"you should learn the web of trust system BEFORE\n" |
| 1147 |
"using PGP to protect your privacy.\n" |
| 1148 |
"**************** IMPORTANT NOTE ****************\n"))) |
| 1149 |
(mew-delete-file mew-pgp-tmp-file)))) |
| 1150 |
|
| 1151 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 1152 |
;;; |
| 1153 |
;;; key fetch |
| 1154 |
;;; |
| 1155 |
|
| 1156 |
(defun mew-pgp-fetch-key-by-xuri () |
| 1157 |
(let (val uri) |
| 1158 |
(with-current-buffer (mew-buffer-message) |
| 1159 |
(catch 'loop |
| 1160 |
(dolist (key mew-x-pgp-key-list) |
| 1161 |
(setq val (mew-header-get-value key)) |
| 1162 |
(when (and val (string-match "http:[^ \t\n]*" val)) |
| 1163 |
(setq val (mew-match-string 0 val)) |
| 1164 |
(if (y-or-n-p (format "Fetch a PGP public key from %s? " val)) |
| 1165 |
(throw 'loop (setq uri val))))))) |
| 1166 |
(if uri |
| 1167 |
(mew-pgp-fetch uri) |
| 1168 |
(message "A PGP key is not fetched")))) |
| 1169 |
|
| 1170 |
(defun mew-pgp-fetch-key (arg) |
| 1171 |
"Fetch a PGP public key. |
| 1172 |
|
| 1173 |
A PGP public key is fetch from one of the PGP PKS servers with a |
| 1174 |
key ID which is extracted from the X-Mew: field. The list of the |
| 1175 |
PGP PKS servers is specified by 'mew-pgp-pks-servers'. |
| 1176 |
|
| 1177 |
If called with \\[universal-argument], a PGP public key is fetched |
| 1178 |
according to a URL in a field specified by 'mew-x-pgp-key-list'." |
| 1179 |
(interactive "P") |
| 1180 |
(if arg |
| 1181 |
(mew-pgp-fetch-key-by-xuri) |
| 1182 |
(let (keyid userid xmew) |
| 1183 |
(with-current-buffer (mew-buffer-message) |
| 1184 |
(setq userid (mew-header-parse-address mew-from:)) |
| 1185 |
(setq xmew (mew-header-get-value mew-x-mew:))) |
| 1186 |
(cond |
| 1187 |
((and xmew |
| 1188 |
(string-match " ID = \\(0x[0-9a-fA-F]+\\)" xmew nil) |
| 1189 |
(setq keyid (mew-match-string 1 xmew))) |
| 1190 |
(if (y-or-n-p (format "Fetch the PGP public key for %s? " keyid)) |
| 1191 |
(mew-pgp-fetch-key-from-pks keyid))) |
| 1192 |
(userid |
| 1193 |
(if (y-or-n-p (format "Fetch the PGP public key for %s? " userid)) |
| 1194 |
(mew-pgp-fetch-key-from-pks userid))) |
| 1195 |
(t |
| 1196 |
(message "A PGP key is not fetched")))))) |
| 1197 |
|
| 1198 |
(defun mew-pgp-fetch-key-from-pks (&optional id) |
| 1199 |
(let* ((alist mew-pgp-pks-servers) |
| 1200 |
(server (car (car alist))) |
| 1201 |
uri) |
| 1202 |
(unless id |
| 1203 |
(setq id (read-string "PGP key id or e-mail address: "))) |
| 1204 |
(setq server (mew-input-general "PGP key server" alist nil server)) |
| 1205 |
(unless (mew-pgp-pks-http-port-p server alist) |
| 1206 |
(setq server (concat server ":" (mew-*-to-string mew-pgp-pks-port)))) |
| 1207 |
(setq uri (concat "http://" server mew-pgp-pks-lang id)) |
| 1208 |
(mew-pgp-fetch uri))) |
| 1209 |
|
| 1210 |
(defun mew-pgp-fetch (uri) |
| 1211 |
(message "PGP key fetching...") |
| 1212 |
(let (pro) |
| 1213 |
(mew-piolet mew-cs-autoconv mew-cs-autoconv |
| 1214 |
(setq pro (apply 'start-process |
| 1215 |
"Mew PGP fetch" |
| 1216 |
(generate-new-buffer mew-buffer-prefix) |
| 1217 |
mew-prog-pgpkey |
| 1218 |
(append mew-prog-pgpkey-args (list uri))))) |
| 1219 |
(set-process-sentinel pro 'mew-pgp-fetch-process-sentinel))) |
| 1220 |
|
| 1221 |
(defun mew-pgp-fetch-process-sentinel (process _event) |
| 1222 |
(message "PGP key fetching...done") |
| 1223 |
(let ((buf (process-buffer process))) |
| 1224 |
(with-current-buffer buf |
| 1225 |
(goto-char (point-min)) |
| 1226 |
(if (and (search-forward mew-pgp-key-begin nil t) |
| 1227 |
(search-forward mew-pgp-key-end nil t)) |
| 1228 |
(mew-mime-pgp-keys-ext (current-buffer) (point-min) (point-max)) |
| 1229 |
(message "PGP key fetch failed"))) |
| 1230 |
(mew-remove-buffer buf))) |
| 1231 |
|
| 1232 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 1233 |
;; <Decrypt> or <Decrypt-then-Verify> |
| 1234 |
;; |
| 1235 |
;; no seckey no secring:: <1> |
| 1236 |
;; You do not have the secret key needed to decrypt this file. |
| 1237 |
;; |
| 1238 |
;; <Verify> <2> |
| 1239 |
;; Keyring file 'pubring.pgp' does not exist. |
| 1240 |
;; Enter public key filename: |
| 1241 |
;; |
| 1242 |
;; Key matching expected Key ID 1B8BF431 not found in file 'pubring.pgp'. |
| 1243 |
;; Enter public key filename: |
| 1244 |
;; |
| 1245 |
;; <Sign> <1> |
| 1246 |
;; |
| 1247 |
;; A secret key is required to make a signature. |
| 1248 |
;; Keyring file 'secring.pgp' does not exist. |
| 1249 |
;; Enter secret key filename: |
| 1250 |
;; |
| 1251 |
;; A secret key is required to make a signature. |
| 1252 |
;; Key matching userid 'foo' not found in file 'secring.pgp'. |
| 1253 |
;; Enter secret key filename: |
| 1254 |
;; |
| 1255 |
;; <Encrypt> |
| 1256 |
;; |
| 1257 |
;; Keyring file 'pubring.pgp' does not exist. |
| 1258 |
;; |
| 1259 |
;; Key matching userid 'foo' not found in file 'pubring.pgp'. |
| 1260 |
;; |
| 1261 |
;; <Verify> |
| 1262 |
;; Keyring file 'pubring.pgp' does not exist. |
| 1263 |
;; |
| 1264 |
;; Key matching expected Key ID 1B8BF431 not found in file 'pubring.pgp'. |
| 1265 |
|
| 1266 |
(provide 'mew-pgp) |
| 1267 |
|
| 1268 |
;;; Copyright Notice: |
| 1269 |
|
| 1270 |
;; Copyright (C) 1994-2015 Mew developing team. |
| 1271 |
;; All rights reserved. |
| 1272 |
|
| 1273 |
;; Redistribution and use in source and binary forms, with or without |
| 1274 |
;; modification, are permitted provided that the following conditions |
| 1275 |
;; are met: |
| 1276 |
;; |
| 1277 |
;; 1. Redistributions of source code must retain the above copyright |
| 1278 |
;; notice, this list of conditions and the following disclaimer. |
| 1279 |
;; 2. Redistributions in binary form must reproduce the above copyright |
| 1280 |
;; notice, this list of conditions and the following disclaimer in the |
| 1281 |
;; documentation and/or other materials provided with the distribution. |
| 1282 |
;; 3. Neither the name of the team nor the names of its contributors |
| 1283 |
;; may be used to endorse or promote products derived from this software |
| 1284 |
;; without specific prior written permission. |
| 1285 |
;; |
| 1286 |
;; THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND |
| 1287 |
;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 1288 |
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 1289 |
;; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE |
| 1290 |
;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 1291 |
;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 1292 |
;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 1293 |
;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 1294 |
;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 1295 |
;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 1296 |
;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 1297 |
|
| 1298 |
;;; mew-pgp.el ends here |