Tell me more ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

gpg -ca passwords.txt create encrypted ASCII file passwords.txt.asc. Emacs open the file as a normal text file:

-----BEGIN PGP MESSAGE-----
Version: GnuPG v2.0.19 (GNU/Linux)

jA0EAwMCkIp3+bQkLWJgyTQYLGVN8EUEG0BE42sEj/8PrnSzgviSiENxtK+/2n73
WXD7EtndVS/MX4lFJ96h8VozChUA
=zSwh
-----END PGP MESSAGE-----

How do I make Emacs auto-decrypt and encrypt the file when I open and save it?

share|improve this question

2 Answers

Everything should work fine with the default configuration, but you can check your configuration.

First, you need to be sure that EasyPG Assistant is installed.

M-xlocate-libraryRETepaRET should return something like:

Library is file /usr/local/share/emacs/24.2.50/lisp/epa.elc

If not, then you've to install it. (or upgrade to Emacs23 or Emacs24)

  1. http://emacswiki.org/emacs/EasyPG
  2. http://epg.sourceforge.jp/

Then, check the value of the variable auto-mode-alist with C-hvauto-mode-alistRET and search for epa.

If you cannot find it, add this snippet to your .emacs.

(add-to-list 'auto-mode-alist '("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil epa-file))
share|improve this answer
I think you mistook my question. I have all the epa stuff ready and can open binary *.gpg file without a problem. I am asking about opening and saving *.asc file. – RNAer Nov 11 '12 at 15:38
up vote 1 down vote accepted

I did following to let Emacs open .asc files in the same way of .gpg files

(require 'epa-file)
(epa-file-enable)
(setq epa-file-name-regexp "\\.\\(gpg\\|asc\\)$")
(epa-file-name-regexp-update)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.