[Mew-dist 13511] PGP 6.5.1i
Shigeki Fujii
fujii at example.com
2000年 7月 7日 (金) 01:02:32 JST
こんばんは。
大阪の藤井と申します。
Mew を PGP 6.5.1i に対応したのでパッチを送ります。
私の環境は、FreeBSD 4.0-STABLE なのですが、最近 ports に pgp-6.5.1i が
入ったのでインストールしてみました。
Mew(1.94.2) を使ってみると、PGP 6 には対応していないようでした。
ちなみに emacs-20.6, IM-140, perl 5.005_03 です。
そこで、mew-pgp.el, pgp-6.5.1i をみてみることにしました。
1. PGP 6 は PGP 2 とコマンド引数等が同等である。
2. Mew は PGP 2 に対応しているので、PGP 6 をだましてつかってみる。
3. ほぼいけてるようだが、署名チェックがうまくいかない。(BAD PGP Sign になる)
4. 署名チェックの旧形式(C-c C-p) ではうまくいく。(pgpにファイルを1つ渡す)
MIME形式だとうまくいかない。(pgpにファイルを2つ渡す)
5. man をみると署名のチェックは
pgp <signature_filename> [-o plaintext_filename]
としている。(decrypt と同じ)
6. mew の PGP 2の設定だと
pgp <signature_filename> [plaintext_filename]
になっているので、mew-prog-arg-input を nil から "-o" にするがだめ
7. コマンドベースでやってみても同じように BAD PGP Sign になる
8. pgp-6.5.1i のソースをみると
pgp hogehoge.sig [ hogehoge ]
とするとうまくいく
署名のチェックは ".asc", ".pgp", ".pkr", ".skr", ".sig" の拡張子が
ついたのが第1引数にきて、その拡張子をとったのが署名チェックされる
ファイルになる。内部処理的には第1引数の拡張子をとったファイルを
チェックする。
9. MIME形式の署名のチェックする mew-decode.el をみると
ファイルを mew-make-temp-name を使って名前を決定している。
ここを変えて hogehoge.sig, hogehoge みたいな感じにすれば良いが
大変そうなので断念
10. pgp 6.5.1i 側を修正する。
pgp <signature_filename> [-o plaintext_filename]
が通るように変更。
11. mew-pgp.el のエラーメッセージ解釈を PGP 6 に合わせる
といったふうに変更しました。
できれば、Mew だけの変更にしたかったのですが、tmp file 作成あたりが
美しくなるのでやめました。
Mew 1.95b43 では試していませんが、mew-pgp.el 辺りはそれほど変わって
いないので同じようにやればいける感じです。
patch は、Mew 1.94.2 の "mew-pgp.el" と pgp-6.5.1i の
"clients/pgp/cmdline/dodecode.c" に対するものです。
----
藤井 茂樹 (Shigeki Fujii)
mailto:fujii at example.com
-------------- next part --------------
*** mew-1.94.2/mew-pgp.el.orig Mon Feb 28 12:52:41 2000
--- mew-1.94.2/mew-pgp.el Thu Jul 6 23:20:42 2000
***************
*** 17,32 ****
;;; PGP 2.6.x is supported.
;;; PGP 5.x is supported. But very ad-hoc.
;;; GNUPG 0.9.x is supported. But very ad-hoc.
;;;
(defvar mew-pgp-ver nil
! "Automatically set 0 if PGP version is 2. Set 1 if 5. Set 2 if GNUPG.")
(defconst mew-pgp-ver2 0)
(defconst mew-pgp-ver5 1)
! (defconst mew-pgp-verg 2)
! (defconst mew-pgp-list '("PGPv2" "PGPv5" "GNUPG"))
! (defconst mew-pgp-keys '(pgpv2 pgpv5 gnupg)) ;; use symbols, cases are string
;; mew-prog-pgp is used only for version check
(defvar mew-prog-pgp2 "pgp") ;; "pgp263i", PGP selection
--- 17,34 ----
;;; PGP 2.6.x is supported.
;;; PGP 5.x is supported. But very ad-hoc.
;;; GNUPG 0.9.x is supported. But very ad-hoc.
+ ;;; PGP 6.x is supported. But very ad-hoc.
;;;
(defvar mew-pgp-ver nil
! "Automatically set 0 if PGP version is 2. Set 1 if 5. Set 2 if 6. Set 3 if GNUPG.")
(defconst mew-pgp-ver2 0)
(defconst mew-pgp-ver5 1)
! (defconst mew-pgp-ver6 2)
! (defconst mew-pgp-verg 3)
! (defconst mew-pgp-list '("PGPv2" "PGPv5" "PGPv6" "GNUPG"))
! (defconst mew-pgp-keys '(pgpv6 pgpv5 pgpv6 gnupg)) ;; use symbols, cases are string
;; mew-prog-pgp is used only for version check
(defvar mew-prog-pgp2 "pgp") ;; "pgp263i", PGP selection
***************
*** 35,110 ****
(defvar mew-prog-pgp5s "pgps")
(defvar mew-prog-pgp5v "pgpv")
(defvar mew-prog-pgp5k "pgpk")
(defvar mew-prog-gpg "gpg") ;; PGP selection
! (defvar mew-prog-pgpe (list mew-prog-pgp2 mew-prog-pgp5e mew-prog-gpg))
! (defvar mew-prog-pgps (list mew-prog-pgp2 mew-prog-pgp5s mew-prog-gpg))
! (defvar mew-prog-pgpv (list mew-prog-pgp2 mew-prog-pgp5v mew-prog-gpg))
! (defvar mew-prog-pgpd (list mew-prog-pgp2 mew-prog-pgp5v mew-prog-gpg))
! (defvar mew-prog-pgpk (list mew-prog-pgp2 mew-prog-pgp5k mew-prog-gpg))
(defconst mew-prog-pgpe-arg
'(("-ea" "+language=en" "+batchmode=on" "+armorlines=0")
("-a" "+language=en" "+batchmode=on" "+armorlines=0")
("--encrypt" "--armor" "--batch")))
(defconst mew-prog-pgpd-arg
'(("+language=en" "+batchmode=off")
("+language=en" "+batchmode=off")
("--decrypt")))
(defconst mew-prog-pgps-arg
'(("-sba" "+language=en" "+batchmode=off")
("-ba" "+language=en" "+batchmode=off")
("--detach-sign" "--armor")))
(defconst mew-prog-pgpv-arg
'(("+batchmode=on" "+language=en")
("+batchmode=on" "+language=en" "+force=on")
("--verify" "--batch")))
! (defconst mew-prog-arg-output '("-o" "-o" "--output"))
! (defconst mew-prog-arg-input '(nil "-o" nil))
! (defconst mew-prog-arg-luserid '("-u" "-u" "--local-user"))
! (defconst mew-prog-arg-ruserid '(nil "-r" "--remote-user"))
(defconst mew-prog-pgpk-add-arg
! '(("-ka" "+batchmode=on") ("-a" "+batchmode=on") ("--import" "--batch")))
(defconst mew-prog-pgpk-ext-arg
! '(("-kxfa") ("-xa") ("--export" "--armor" "--batch")))
(defconst mew-pgp-msg-signature
'("\n\\(.*\\) signature from user \\(.*\\)\\."
"\n\\(.*\\) signature made"
" \\(.*\\) signature from \"\\(.*\\)\""))
(defconst mew-pgp-msg-key-id
'("Key ID \\(\\S +\\) not found"
": \\(0x[0-9A-Za-z]+\\)"
"xxx"))
(defconst mew-pgp-msg-bad-pass
! '("No passphrase" "Cannot unlock private key\\|It can only be decrypted" "bad passphrase"))
(defconst mew-pgp-msg-enter
! '("Enter" "Enter" "xxx"))
(defconst mew-pgp-msg-enter-pass
! '("Enter pass phrase: " "Enter pass phrase: " "Enter passphrase: "))
(defconst mew-pgp-msg-reenter-pass
! '("Enter pass phrase: " "Enter pass phrase: " "Enter passphrase: "))
(defconst mew-pgp-msg-no-enckey
! '("Key matching" "No encryption keys" "public key not found"))
(defconst mew-pgp-msg-no-validkey
! '("DUMMY" "^WARNING:[ -9;-~\n]+belongs? to:" "no info to calculate a trust probability")) ;;xxx
(defconst mew-pgp-msg-no-vrfkey
! '("Key matching" "unknown keyid" "public key not found"))
(defconst mew-pgp-msg-no-keyring
! '("Keyring file" "Keyring file" "public key not found"))
(defconst mew-pgp-msg-no-seckey-or-secring
'("You do not have the secret key"
"Cannot find a private key"
": decryption failed: secret key not available"))
(defconst mew-pgp-msg-unsupported
'("Unsupported packet format" ;; including algorithms and packets
"Unsupported packet format\\|None of the signatures were understood"
"xxx"))
(defconst mew-pgp-verify-addr
! '(".* \\(signature from user\\) " "\\( \\)" "gpg: .* \\(from\\|aka\\) "))
;; 2: ASCII armor corrupted
;; 3:
--- 37,129 ----
(defvar mew-prog-pgp5s "pgps")
(defvar mew-prog-pgp5v "pgpv")
(defvar mew-prog-pgp5k "pgpk")
+ (defvar mew-prog-pgp6 "pgp") ;; "pgp651i", PGP selection
(defvar mew-prog-gpg "gpg") ;; PGP selection
! (defvar mew-prog-pgpe
! (list mew-prog-pgp2 mew-prog-pgp5e mew-prog-pgp6 mew-prog-gpg))
! (defvar mew-prog-pgps
! (list mew-prog-pgp2 mew-prog-pgp5s mew-prog-pgp6 mew-prog-gpg))
! (defvar mew-prog-pgpv
! (list mew-prog-pgp2 mew-prog-pgp5v mew-prog-pgp6 mew-prog-gpg))
! (defvar mew-prog-pgpd
! (list mew-prog-pgp2 mew-prog-pgp5v mew-prog-pgp6 mew-prog-gpg))
! (defvar mew-prog-pgpk
! (list mew-prog-pgp2 mew-prog-pgp5k mew-prog-pgp6 mew-prog-gpg))
(defconst mew-prog-pgpe-arg
'(("-ea" "+language=en" "+batchmode=on" "+armorlines=0")
("-a" "+language=en" "+batchmode=on" "+armorlines=0")
+ ("-ea" "+language=en" "+batchmode=on" "+armorlines=0")
("--encrypt" "--armor" "--batch")))
(defconst mew-prog-pgpd-arg
'(("+language=en" "+batchmode=off")
("+language=en" "+batchmode=off")
+ ("+language=en" "+batchmode=off")
("--decrypt")))
(defconst mew-prog-pgps-arg
'(("-sba" "+language=en" "+batchmode=off")
("-ba" "+language=en" "+batchmode=off")
+ ("-sba" "+language=en" "+batchmode=off")
("--detach-sign" "--armor")))
(defconst mew-prog-pgpv-arg
'(("+batchmode=on" "+language=en")
("+batchmode=on" "+language=en" "+force=on")
+ ("+batchmode=on" "+language=en")
("--verify" "--batch")))
! (defconst mew-prog-arg-output '("-o" "-o" "-o" "--output"))
! (defconst mew-prog-arg-input '(nil "-o" "-o" nil))
! (defconst mew-prog-arg-luserid '("-u" "-u" "-u" "--local-user"))
! (defconst mew-prog-arg-ruserid '(nil "-r" nil "--remote-user"))
(defconst mew-prog-pgpk-add-arg
! '(("-ka" "+batchmode=on") ("-a" "+batchmode=on") ("-ka" "+batchmode=on") ("--import" "--batch")))
(defconst mew-prog-pgpk-ext-arg
! '(("-kxfa") ("-xa") ("-kxfa") ("--export" "--armor" "--batch")))
(defconst mew-pgp-msg-signature
'("\n\\(.*\\) signature from user \\(.*\\)\\."
"\n\\(.*\\) signature made"
+ "\\([0-9A-Za-z]*\\) signature from user \\(.*\\)\\."
" \\(.*\\) signature from \"\\(.*\\)\""))
(defconst mew-pgp-msg-key-id
'("Key ID \\(\\S +\\) not found"
": \\(0x[0-9A-Za-z]+\\)"
+ ": \\(0x[0-9A-Za-z]+\\)"
"xxx"))
(defconst mew-pgp-msg-bad-pass
! '("No passphrase" "Cannot unlock private key\\|It can only be decrypted" "Bad pass phrase" "bad passphrase"))
(defconst mew-pgp-msg-enter
! '("Enter" "Enter" "Enter" "xxx"))
(defconst mew-pgp-msg-enter-pass
! '("Enter pass phrase: " "Enter pass phrase: " "Enter pass phrase: " "Enter passphrase: "))
(defconst mew-pgp-msg-reenter-pass
! '("Enter pass phrase: " "Enter pass phrase: " "Enter pass phrase: " "Enter passphrase: "))
(defconst mew-pgp-msg-no-enckey
! '("Key matching" "No encryption keys" "public key matching" "public key not found"))
(defconst mew-pgp-msg-no-validkey
! '("DUMMY"
! "^WARNING:[ -9;-~\n]+belongs? to:"
! "^WARNING:[ -9;-~\n]+belongs? to:"
! "no info to calculate a trust probability")) ;;xxx
(defconst mew-pgp-msg-no-vrfkey
! '("Key matching" "unknown keyid" "key does not meet" "public key not found"))
(defconst mew-pgp-msg-no-keyring
! '("Keyring file" "Keyring file" "NO MESSAGE" "public key not found"))
(defconst mew-pgp-msg-no-seckey-or-secring
'("You do not have the secret key"
"Cannot find a private key"
+ "Signature error"
": decryption failed: secret key not available"))
(defconst mew-pgp-msg-unsupported
'("Unsupported packet format" ;; including algorithms and packets
"Unsupported packet format\\|None of the signatures were understood"
+ "Unsupported packet format" ;; including algorithms and packets
"xxx"))
(defconst mew-pgp-verify-addr
! '(".* \\(signature from user\\) " "\\( \\)" ".* \\(signature from user\\) " "gpg: .* \\(from\\|aka\\) "))
;; 2: ASCII armor corrupted
;; 3:
***************
*** 113,121 ****
;; 2: ERROR: or Error:
(defconst mew-pgp-msg-no-export-key
! '("Key not found" "No keys" "nothing exported"))
! (defvar mew-pgp-micalg '("pgp-md5" "pgp-sha1" "pgp-sha1"))
;;
;;
--- 132,140 ----
;; 2: ERROR: or Error:
(defconst mew-pgp-msg-no-export-key
! '("Key not found" "No keys" "Key not found" "nothing exported"))
! (defvar mew-pgp-micalg '("pgp-md5" "pgp-sha1" "pgp-sha1" "pgp-sha1"))
;;
;;
***************
*** 182,188 ****
(goto-char (point-min))
(if (search-forward "gpg" nil t)
(setq mew-pgp-ver mew-pgp-verg)
! (setq mew-pgp-ver nil)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
--- 201,210 ----
(goto-char (point-min))
(if (search-forward "gpg" nil t)
(setq mew-pgp-ver mew-pgp-verg)
! (goto-char (point-min))
! (if (search-forward "Pretty Good Privacy(tm) Version 6" nil t)
! (setq mew-pgp-ver mew-pgp-ver6)
! (setq mew-pgp-ver nil))))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
***************
*** 787,792 ****
--- 809,816 ----
(insert "\"pgp -ke\" and \"pgp -ks\" to change them.\n"))
((equal mew-pgp-ver mew-pgp-ver5)
(insert "\"pgpk -e\" and \"pgpk -s\" to change them.\n"))
+ ((equal mew-pgp-ver mew-pgp-ver6)
+ (insert "\"pgp -ke\" and \"pgp -ks\" to change them.\n"))
((equal mew-pgp-ver mew-pgp-verg)
(insert "\"gpg --edit-key\" to change them.\n")))
(insert "If you don't know what TRUST and VALIDITY is,\n"
-------------- next part --------------
*** clients/pgp/cmdline/dodecode.c.orig Tue Oct 5 21:27:32 1999
--- clients/pgp/cmdline/dodecode.c Thu Jul 6 23:24:43 2000
***************
*** 298,304 ****
/* to the output routines...*/
mainbPtr->separateSignature = TRUE;
! dropExtension( filebPtr, mainbPtr->plainfilename );
if (!quietmode) fprintf( filebPtr->pgpout,
LANG("Text is assumed to be in file '%s'.\n"),
mainbPtr->plainfilename);
--- 298,307 ----
/* to the output routines...*/
mainbPtr->separateSignature = TRUE;
! if (mainbPtr->argsbPtr->outputFileName == NULL)
! dropExtension( filebPtr, mainbPtr->plainfilename );
! else
! strcpy(mainbPtr->plainfilename, mainbPtr->argsbPtr->outputFileName);
if (!quietmode) fprintf( filebPtr->pgpout,
LANG("Text is assumed to be in file '%s'.\n"),
mainbPtr->plainfilename);
Mew-dist メーリングリストの案内