[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: generic mode for pgp encrypted files e.g. to store passwords
From: |
Josef Bauer |
Subject: |
Re: generic mode for pgp encrypted files e.g. to store passwords |
Date: |
02 Aug 2004 13:27:03 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
RMS> Could you possibly make it into a contribution to Mailcrypt?
Josef> Well ... in my view it is only a tiny gimmick for .emacs
Josef> files. So I am impressed to hear from RMS in person :-0 . But
Josef> given this fact I will think about that ;-) .
Maybe I should wait if someone sees need for improvement. I put the
emails found on the http://mailcrypt.sourceforge.net site to
BCC. Although ... the site does not look very active to me.
RMS> We recommend GPG, which is free software, over PGP which is not.
RMS> Does this work with GPG as well?
Josef> No ... at the moment it is partly hard coded to pgp. I need to
Josef> check what needs to be done to make it work with gpg. I
Josef> believe that my current version of mailcrypt does not support
Josef> gpg but newer versions should do.
Below I put a version that works for mailcrypt 3.5.8, gpg 1.2.4 and
(again) GNU emacs 21.3.1.
First a related part of my .emacs:
;---------------------------------------------------------------------
(require 'mailcrypt)
(mc-setversion "gpg") ; for PGP 2.6 (default); also "5.0" and "gpg"
(setq mc-gpg-user-id "address@hidden")
;---------------------------------------------------------------------
And this is the generic mode for gpg encrypted files:
;---------------------------------------------------------------------
(define-generic-mode 'mc-gpg-file-mode
(list ?#)
nil nil
'(".gpg\\'" ".gpg-encrypted\\'")
(list (lambda ()
(add-hook 'local-write-file-hooks
(lambda ()
(setq mc-pgp-always-sign 'never)
(mc-gpg-encrypt-region
(list mc-gpg-user-id)
(point-min) (point-max) 0)
nil nil) nil t)
(add-hook 'after-save-hook
(lambda () (mc-decrypt)
(set-buffer-modified-p nil))
nil t)
(mc-decrypt)
(auto-save-mode nil)
(set-buffer-modified-p nil))
)
"Mode for gpg encrypted files"
)
;---------------------------------------------------------------------
Best regards
Josef