emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Julien Danjou <julien@danjou.info>
To: Bastien <bzg@altern.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-crypt.el security problem (From: Milan Zamazal)
Date: Mon, 07 Mar 2011 12:08:10 +0100	[thread overview]
Message-ID: <sa362rvyyqt.fsf@cigue.easter-eggs.fr> (raw)
In-Reply-To: <87wrkcnngy.fsf@gnu.org> (Bastien's message of "Sun, 06 Mar 2011 18:54:53 +0100")

[-- Attachment #1: Type: text/plain, Size: 1253 bytes --]

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 #2: Type: application/pgp-signature, Size: 835 bytes --]

  reply	other threads:[~2011-03-07 11:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-04 15:06 org-crypt.el security problem (From: Milan Zamazal) Peter Jones
2011-03-04 15:39 ` Julien Danjou
2011-03-06 10:01   ` Bastien
2011-03-06 10:47     ` Julien Danjou
2011-03-06 17:54       ` Bastien
2011-03-07 11:08         ` Julien Danjou [this message]
2011-03-06  9:59 ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sa362rvyyqt.fsf@cigue.easter-eggs.fr \
    --to=julien@danjou.info \
    --cc=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).