emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org-crypt.el security problem (From: Milan Zamazal)


From: Julien Danjou
Subject: Re: [O] org-crypt.el security problem (From: Milan Zamazal)
Date: Mon, 07 Mar 2011 12:08:10 +0100
User-agent: Gnus/5.110014 (No Gnus v0.14) Emacs/24.0.50 (gnu/linux)

On Sun, Mar 06 2011, Bastien wrote:

>> What I can also suggest is to never show the encrypted block in the Org
>> buffer.
>
> I agree this would be better.
>
>> This is what I do in my configuration: on Org file loading, I decrypt
>> all entries. Therefore I never see the GPG block. When I save,
>> everything is encrypted, written, and then re-decrypted.
>
> Can you share your config?

NO WAY!

But here it is:

#+begin_src emacs-listp
(org-crypt-use-before-save-magic)
(defun jd:org-decrypt-everything-silently ()
  (let ((m (buffer-modified-p)))
    (org-decrypt-entries)
    (unless m
      (set-buffer-modified-p nil))))
(add-hook 'org-mode-hook 'jd:org-decrypt-everything-silently)
(add-hook 'org-mode-hook (lambda ()
                           (add-hook 'after-save-hook 
'jd:org-decrypt-everything-silently)))
#+end_src

- Loading org-mode on a file decrypt everything;
- Saving encrypt everything (org-crypt-use-before-save-magic adds this);
- After-saving we re-decrypt.

Using this method with auto-save-hook should be possible.

> I see: auto-save-hook would encrypt, write to ~/.#file# then decrypt the
> original buffer back again -- yes?

Yup.

-- 
Julien Danjou
❱ http://julien.danjou.info

Attachment: pgp3C1gvFekrh.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]