7.23. Maintaining Encrypted Files with Emacs
Problem
You want to edit encrypted files in place with GNU Emacs, without decrypting them to disk.
Solution
Use the Emacs package crypt++.el :
~/.emacs:
(if (load "crypt++" t)
(progn
(setq crypt-encryption-type 'gpg)
(setq crypt-confirm-password t)
(crypt-rebuild-tables)))
Discussion
crypt++ provides a transparent editing mode for encrypted files. Once the package is installed and loaded, simply edit any GnuPG-encrypted file. You’ll be prompted for the passphrase within Emacs, and the file will be decrypted and inserted into an Emacs buffer. When you save the file, it will be re-encrypted automatically.
See Also
Crypt++ is available from http://freshmeat.net/projects/crypt and http://www.cs.umb.edu/~karl/crypt++/crypt++.el.
Get Linux Security Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.