I showed you my source code, pls respond
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.0 KiB

  1. #+TITLE: GPG
  2. #+AUTHOR: Christopher James Hayward
  3. #+EMAIL: chris@chrishayward.xyz
  4. #+PROPERTY: header-args:emacs-lisp :tangle gpg.el :comments org
  5. #+PROPERTY: header-args:shell :tangle no
  6. #+PROPERTY: header-args :results silent :eval no-export :comments org
  7. #+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
  8. #+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
  9. Handle GPG[fn:1] pinentry within Emacs.
  10. * Setup
  11. :PROPERTIES:
  12. :header-args: :tangle ../config/gpg-agent.conf
  13. :END:
  14. When the ~gpg-agent~[fn:1] loads it will read the configuration at =~/.gnupg/gpg-agent.conf=. Override the default settings to allow Emacs to function as the Pinentry application.
  15. #+begin_src conf
  16. allow-emacs-pinentry
  17. allow-loopback-pinentry
  18. #+end_src
  19. You may need to restart the ~gpg-agent~[fn:1] to load the configuration without rebooting.
  20. #+begin_src shell :tangle nil
  21. gpgconf --reload gpg-agent
  22. #+end_src
  23. * Config
  24. Create the symbolic link to the configuration file.
  25. #+begin_src emacs-lisp
  26. (dotfiles/symlink "~/.emacs.d/config/gpg-agent.conf"
  27. "~/.gnupg/gpg-agent.conf")
  28. #+end_src
  29. With the ~pinentry~[fn:2] package for Emacs prompts will now appear in the minibuffer. Increase the minimum prime bit size to increase performance during symmetric encryption.
  30. #+begin_src emacs-lisp
  31. (use-package pinentry
  32. :custom (epa-file-select-keys 2)
  33. (gnutls-min-prime-bits 4096)
  34. (epa-pinentry-mode 'loopback)
  35. (epa-file-encrypt-to dotfiles/public-key)
  36. (epa-file-cache-passphrase-for-symmetric-encryption t)
  37. :config (pinentry-start))
  38. #+end_src
  39. ** Including agenda files
  40. Override ~org-agenda-file-regexp~ to include =.org.gpg= files.
  41. #+begin_src emacs-lisp
  42. (unless (string-match-p "\\.gpg" org-agenda-file-regexp)
  43. (setq org-agenda-file-regexp
  44. (replace-regexp-in-string "\\\\\\.org" "\\\\.org\\\\(\\\\.gpg\\\\)?"
  45. org-agenda-file-regexp)))
  46. #+end_src
  47. * Footnotes
  48. [fn:1] https://gnupg.org
  49. [fn:2] https://elpa.gnu.org/packages/pinentry.html