Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I still use a GPG encrypted org-mode file. Emacs/org-mode opens it seamlessly.

I feel like I should move to Keepass at some point, but it's one of those cases where if I'm apathetic long enough, Keepass will be gone and I'll still have my Emacs setup.



I use pass nowadays but used to use org for passwords, but in my setup I used to only encrypt the contents of entries, i.e. headings were in plain text. Then I used the function below to decrypt them. Made it easier to browse the file.

  (cl-defun gk-org-decrypt-element ()
    "Decrypt the element under point, show in a new buffer."
    (interactive)
    (save-excursion
      (let ((transient-mark-mode t))
        (org-mark-element)
        (epa-decrypt-region
         (region-beginning) (region-end)
         (lambda ()
           (let ((decrypted-elem (org-get-heading t t))
                 (bufnam (buffer-name)))
             (prog1
                 (switch-to-buffer (get-buffer-create "*Org Secret*"))
               (read-only-mode -1)
               (fundamental-mode)
               (erase-buffer)
               (insert ">>> " decrypted-elem " (" bufnam ")")
               (newline)
               (insert ">>> Hit `Q' in order to *kill* this buffer.")
               (newline 2)
               (special-mode)
               (local-set-key [?Q] 'kill-this-buffer))))))))




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: