emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Automatically encrypt on save, decrypt on open?
@ 2015-08-13 14:28 Peter Davis
  2015-08-13 14:46 ` John Kitchin
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Peter Davis @ 2015-08-13 14:28 UTC (permalink / raw)
  To: emacs-orgmode


I'd like to store information in an org page that gets automatically encrypted when I save it, and decrypted when I open it. Is
there some built-in functionality or hooks for this?

Thank you,
-pd

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Automatically encrypt on save, decrypt on open?
  2015-08-13 14:28 Automatically encrypt on save, decrypt on open? Peter Davis
@ 2015-08-13 14:46 ` John Kitchin
  2015-08-13 14:53   ` Peter Davis
  2015-08-14  8:01   ` Sebastien Vauban
  2015-08-13 14:53 ` Michael Strey
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 12+ messages in thread
From: John Kitchin @ 2015-08-13 14:46 UTC (permalink / raw)
  To: Peter Davis; +Cc: emacs-orgmode

see org-crypt http://orgmode.org/worg/org-tutorials/encrypting-files.html

Here is the setup I have that worked when I tried it last ;)

;; encryption
(require 'epa-file)
(unless (memq epa-file-handler file-name-handler-alist)
  (epa-file-enable))

(require 'org-crypt)
(org-crypt-use-before-save-magic)
(setq org-tags-exclude-from-inheritance (quote ("crypt")))
;; GPG key to use for encryption
;; Either the Key ID or set to nil to use symmetric encryption.
(setq org-crypt-key "some-key")



Peter Davis writes:

> I'd like to store information in an org page that gets automatically encrypted when I save it, and decrypted when I open it. Is
> there some built-in functionality or hooks for this?
>
> Thank you,
> -pd

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Automatically encrypt on save, decrypt on open?
  2015-08-13 14:46 ` John Kitchin
@ 2015-08-13 14:53   ` Peter Davis
  2015-08-14  8:01   ` Sebastien Vauban
  1 sibling, 0 replies; 12+ messages in thread
From: Peter Davis @ 2015-08-13 14:53 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode


Thanks, John! I'll give it a try.

-pd

John Kitchin <jkitchin@andrew.cmu.edu> writes:

> see org-crypt http://orgmode.org/worg/org-tutorials/encrypting-files.html
>
> Here is the setup I have that worked when I tried it last ;)
>
> ;; encryption
> (require 'epa-file)
> (unless (memq epa-file-handler file-name-handler-alist)
>   (epa-file-enable))
>
> (require 'org-crypt)
> (org-crypt-use-before-save-magic)
> (setq org-tags-exclude-from-inheritance (quote ("crypt")))
> ;; GPG key to use for encryption
> ;; Either the Key ID or set to nil to use symmetric encryption.
> (setq org-crypt-key "some-key")
>
>
>
> Peter Davis writes:
>
>> I'd like to store information in an org page that gets automatically encrypted when I save it, and decrypted when I open it. Is
>> there some built-in functionality or hooks for this?
>>
>> Thank you,
>> -pd
>
> --
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Automatically encrypt on save, decrypt on open?
  2015-08-13 14:28 Automatically encrypt on save, decrypt on open? Peter Davis
  2015-08-13 14:46 ` John Kitchin
@ 2015-08-13 14:53 ` Michael Strey
  2015-08-13 15:34 ` Eric S Fraga
  2015-08-14 17:54 ` Jorge A. Alfaro-Murillo
  3 siblings, 0 replies; 12+ messages in thread
From: Michael Strey @ 2015-08-13 14:53 UTC (permalink / raw)
  To: emacs-orgmode

On Do, 2015-08-13 at 16:28, Peter Davis wrote:
> I'd like to store information in an org page that gets automatically
> encrypted when I save it, and decrypted when I open it. Is there some
> built-in functionality or hooks for this?

Check org-crypt.el (http://orgmode.org/manual/org_002dcrypt_002eel.html)

-- 
Michael Strey
http://www.strey.biz * https://twitter.com/michaelstrey

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Automatically encrypt on save, decrypt on open?
  2015-08-13 14:28 Automatically encrypt on save, decrypt on open? Peter Davis
  2015-08-13 14:46 ` John Kitchin
  2015-08-13 14:53 ` Michael Strey
@ 2015-08-13 15:34 ` Eric S Fraga
  2015-08-13 15:47   ` Peter Davis
  2015-08-14 17:54 ` Jorge A. Alfaro-Murillo
  3 siblings, 1 reply; 12+ messages in thread
From: Eric S Fraga @ 2015-08-13 15:34 UTC (permalink / raw)
  To: Peter Davis; +Cc: emacs-orgmode

On Thursday, 13 Aug 2015 at 10:28, Peter Davis wrote:
> I'd like to store information in an org page that gets automatically
> encrypted when I save it, and decrypted when I open it. Is
> there some built-in functionality or hooks for this?

An alternative to using org's own encryption facility, as others have
suggested, is to encrypt the file as a whole and let emacs worry about
it.

If you create an encrypted file (say using gnupg on the command line)
with the following first line:

# -*- mode: org; epa-file-encrypt-to: ("your key name/email"); version-control: nil; -*-

then opening the file will start it up in org mode and will encrypt on
saving.

I prefer this in some cases although I do also use org's capabilities
for some sections in a file.
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.1-34-gb911f1

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Automatically encrypt on save, decrypt on open?
  2015-08-13 15:34 ` Eric S Fraga
@ 2015-08-13 15:47   ` Peter Davis
  2015-08-13 16:09     ` Eric S Fraga
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Davis @ 2015-08-13 15:47 UTC (permalink / raw)
  To: emacs-orgmode


Thanks! This might be the best solution, since it's really just one file I want to encrypt/decrypt.

-pd


Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Thursday, 13 Aug 2015 at 10:28, Peter Davis wrote:
>> I'd like to store information in an org page that gets automatically
>> encrypted when I save it, and decrypted when I open it. Is
>> there some built-in functionality or hooks for this?
>
> An alternative to using org's own encryption facility, as others have
> suggested, is to encrypt the file as a whole and let emacs worry about
> it.
>
> If you create an encrypted file (say using gnupg on the command line)
> with the following first line:
>
> # -*- mode: org; epa-file-encrypt-to: ("your key name/email"); version-control: nil; -*-
>
> then opening the file will start it up in org mode and will encrypt on
> saving.
>
> I prefer this in some cases although I do also use org's capabilities
> for some sections in a file.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Automatically encrypt on save, decrypt on open?
  2015-08-13 15:47   ` Peter Davis
@ 2015-08-13 16:09     ` Eric S Fraga
  0 siblings, 0 replies; 12+ messages in thread
From: Eric S Fraga @ 2015-08-13 16:09 UTC (permalink / raw)
  To: Peter Davis; +Cc: emacs-orgmode

On Thursday, 13 Aug 2015 at 11:47, Peter Davis wrote:
> Thanks! This might be the best solution, since it's really just one
> file I want to encrypt/decrypt.

If you want to encrypt all the contents of a file, this is indeed the
best approach, I think.  If you only want to encrypt a small part, then
org's crypt features are better.  The latter, however, become clumsy to
use when the whole file is to be encrypted.
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.1-34-gb911f1

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Automatically encrypt on save, decrypt on open?
  2015-08-13 14:46 ` John Kitchin
  2015-08-13 14:53   ` Peter Davis
@ 2015-08-14  8:01   ` Sebastien Vauban
  2015-08-14 10:48     ` John Kitchin
  1 sibling, 1 reply; 12+ messages in thread
From: Sebastien Vauban @ 2015-08-14  8:01 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello John,

> Here is the setup I have that worked when I tried it last ;)
>
> ;; encryption
> (require 'epa-file)
> (unless (memq epa-file-handler file-name-handler-alist)
>   (epa-file-enable))

Do you remember what are those 2 lines for?

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Automatically encrypt on save, decrypt on open?
  2015-08-14  8:01   ` Sebastien Vauban
@ 2015-08-14 10:48     ` John Kitchin
  2015-08-14 12:45       ` Sebastien Vauban
  0 siblings, 1 reply; 12+ messages in thread
From: John Kitchin @ 2015-08-14 10:48 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: emacs-orgmode@gnu.org

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

They are basically copied from thetop of
http://orgmode.org/worg/org-tutorials/encrypting-files.html

The first line loads epa-file (epa-file.el --- the EasyPG Assistant,
transparent file encryption )

The second line looks like a way to call epa-file-enable if it hasn't been
enabled. You can just call epa-file-enable, and it does the check too, but
this probably avoids a minibuffer message when it is already loaded. I
think this function provides a handler for files ending in .gpg which need
to be en/decrypted by gpg.

John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu


On Fri, Aug 14, 2015 at 4:01 AM, Sebastien Vauban <sva-news@mygooglest.com>
wrote:

> Hello John,
>
> > Here is the setup I have that worked when I tried it last ;)
> >
> > ;; encryption
> > (require 'epa-file)
> > (unless (memq epa-file-handler file-name-handler-alist)
> >   (epa-file-enable))
>
> Do you remember what are those 2 lines for?
>
> Best regards,
>   Seb
>
> --
> Sebastien Vauban
>
>
>

[-- Attachment #2: Type: text/html, Size: 1979 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Automatically encrypt on save, decrypt on open?
  2015-08-14 10:48     ` John Kitchin
@ 2015-08-14 12:45       ` Sebastien Vauban
  0 siblings, 0 replies; 12+ messages in thread
From: Sebastien Vauban @ 2015-08-14 12:45 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello John,

>> > Here is the setup I have that worked when I tried it last ;)
>> >
>> > ;; encryption
>> > (require 'epa-file)
>> > (unless (memq epa-file-handler file-name-handler-alist)
>> >   (epa-file-enable))
>>
>> Do you remember what are those 2 lines for?
>
> They are basically copied from thetop of
> http://orgmode.org/worg/org-tutorials/encrypting-files.html
>
> The first line loads epa-file (epa-file.el --- the EasyPG Assistant,
> transparent file encryption )
>
> The second line looks like a way to call epa-file-enable if it hasn't been
> enabled. You can just call epa-file-enable, and it does the check too, but
> this probably avoids a minibuffer message when it is already loaded. I
> think this function provides a handler for files ending in .gpg which need
> to be en/decrypted by gpg.

It simply because it Just Works (TM) with those 3 lines which I have in
my .emacs file:

--8<---------------cut here---------------start------------->8---
  ;; EasyPG Assistant
  (with-eval-after-load "epa-file"
    (setq epa-file-encrypt-to "john-Ch9RrZxMC0c@public.gmane.org")
    (setq epa-file-cache-passphrase-for-symmetric-encryption t))
--8<---------------cut here---------------end--------------->8---

Best regards,
  Seb

--
Sebastien Vauban

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Automatically encrypt on save, decrypt on open?
  2015-08-13 14:28 Automatically encrypt on save, decrypt on open? Peter Davis
                   ` (2 preceding siblings ...)
  2015-08-13 15:34 ` Eric S Fraga
@ 2015-08-14 17:54 ` Jorge A. Alfaro-Murillo
  2015-08-14 19:11   ` Marcin Borkowski
  3 siblings, 1 reply; 12+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2015-08-14 17:54 UTC (permalink / raw)
  To: emacs-orgmode

Peter Davis writes:

> I'd like to store information in an org page that gets 
> automatically encrypted when I save it, and decrypted when I 
> open it. Is there some built-in functionality or hooks for this?

You could save the file as .gpg, and put as its first line

# -*- mode: org-mode -*-

By the way if you want to store passwords, take a look at 
org-passwords in /contrib

Best,
-- 
Jorge.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Automatically encrypt on save, decrypt on open?
  2015-08-14 17:54 ` Jorge A. Alfaro-Murillo
@ 2015-08-14 19:11   ` Marcin Borkowski
  0 siblings, 0 replies; 12+ messages in thread
From: Marcin Borkowski @ 2015-08-14 19:11 UTC (permalink / raw)
  To: emacs-orgmode


On 2015-08-14, at 19:54, Jorge A. Alfaro-Murillo <jorge.alfaro-murillo@yale.edu> wrote:

> Peter Davis writes:
>
>> I'd like to store information in an org page that gets 
>> automatically encrypted when I save it, and decrypted when I 
>> open it. Is there some built-in functionality or hooks for this?
>
> You could save the file as .gpg, and put as its first line
>
> # -*- mode: org-mode -*-

In my setup (and I didn't do anything special, just installed gpg from
Ubuntu repos), it is enough to name the file foo.org.gpg (of course,
I have this: (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))).
 
> Best,

Hth,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-08-14 19:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-13 14:28 Automatically encrypt on save, decrypt on open? Peter Davis
2015-08-13 14:46 ` John Kitchin
2015-08-13 14:53   ` Peter Davis
2015-08-14  8:01   ` Sebastien Vauban
2015-08-14 10:48     ` John Kitchin
2015-08-14 12:45       ` Sebastien Vauban
2015-08-13 14:53 ` Michael Strey
2015-08-13 15:34 ` Eric S Fraga
2015-08-13 15:47   ` Peter Davis
2015-08-13 16:09     ` Eric S Fraga
2015-08-14 17:54 ` Jorge A. Alfaro-Murillo
2015-08-14 19:11   ` Marcin Borkowski

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).