鏡と申します.
> どなたかWindowsでマスターパスワードがうまく使えている方はいませんでしょ
> うか。いましたら設定方法を教えてください。
3年近く経ってからの返信ですみませんが,最近マスターパスワードを使うよ
うに変えようとしたところ,私の環境でもうまく動きませんでした.解決に至っ
ていませんが,状況と workaround を報告します.環境は
64-bit Windows 10 Home 20H2
GNU Emacs 27.2 (公式の emacs-27.2-x86_64.zip)
Mew Version 6.8 (公式の MEW68W2.ZIP)
です.
mew-prog-passwd に GnuPG の Windows 用バイナリ (公式の version 2.3.3
または version 1.4.23) を指定すると,
「Communicating with the POP server...」
の時点で無反応になります.C-g で先に進むと
「error in process filter: Renaming: no such file or directory」
というエラーになります.
Cygwin の gpg2 (version 2.2.33) を指定すると,pinentry でパスフレーズ
を入力するところまで進み,~/Mail/.mew-passwd.gpg が生成されますが,
「Sending your POP password to the POP server...」
のまま無反応になります.
Cygwin の gpg (version 1.4.23) を指定した場合は無反応にはなりませんが,
「Master password is wrong! Passwords not saved」
「error in process filter: Renaming: no such file or directory」
が表示されます.gpg は「gpg: cannot open tty `no tty'」と出力していま
した.(環境は違いますが以下のスレッドの症状と似ています)
https://groups.google.com/g/mew-ja/c/VoGfYEP-blo
なお今回の本題ではありませんが,このうち「Renaming: no such file or
directory」については,mew-passwd.el の 254-255 行目を
(unless (file-exists-p file)
(rename-file (concat file mew-backup-suffix) file))
から
(when (and (not (file-exists-p file)) (file-exists-p (concat file mew-backup-suffix)))
(rename-file (concat file mew-backup-suffix) file))
に修正すると解消されます.
本題に戻りますが,原因追及は断念して .mew-passwd.gpg の読み書きに
EasyPG を使うことにしました.~/.mew.el に以下を書いています.
mew-epg-passwd-recipient に暗号化ファイルの受け取り相手 (普通は自分)
を指定して,公開鍵暗号を使います.
(nil を指定すれば対象鍵暗号も使えますが,Emacs 終了時にパスフレーズを
聞かれることになるので不便です)
;;;;;;;;;
(defvar mew-use-epg-passwd t
"If non-nil, passwd file is read/written through EasyPG.")
(defvar mew-epg-passwd-recipient "
us...@example.org"
"Name, or list of names, of recipient to whom EasyPG encrypts passwd.
If nil, symmetric encryption is applied.")
(when mew-use-epg-passwd
(setq mew-use-master-passwd t)
(require 'epg)
(advice-add
'mew-passwd-save :override
'(lambda ()
(with-temp-buffer
(pp mew-passwd-alist (current-buffer))
(let* ((context (epg-make-context))
(plain (buffer-substring-no-properties (point-min) (point-max)))
(key (and
mew-epg-passwd-recipient
(epg-list-keys context mew-epg-passwd-recipient 'public)))
(cipher (epg-encrypt-string context plain key)))
(delete-region (point-min) (point-max))
(insert cipher))
(epa-file-disable)
(let ((file (expand-file-name mew-passwd-file mew-conf-path))
(coding-system-for-write 'binary))
(write-region (point-min) (point-max) file nil 'no-msg))
(epa-file-enable))))
(advice-add
'mew-passwd-load :override
'(lambda ()
(let* ((file (expand-file-name mew-passwd-file mew-conf-path))
(pwds (read (epg-decrypt-file (epg-make-context) file nil))))
(setq mew-passwd-master t)
pwds))))
;;;;;;;;;
--
鏡 慎吾 --
s...@kagami.org