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.

104 lines
3.3 KiB

  1. #+TITLE: Encryption
  2. #+AUTHOR: Christopher James Hayward
  3. #+EMAIL: chris@chrishayward.xyz
  4. #+PROPERTY: header-args:emacs-lisp :tangle encryption.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. My source files encrypted with symmetric key encryption via *GPG*[fn:1]. This enables my workflow of storing my personal notes anywhere, including checked in to a public source repository. Emacs can cache the *GPG*[fn:1] password if you trust your session. *Pinentry*[fn:2] handled within Emacs to remain compatible without the [[file:desktop.org][Desktop]] module.
  10. * Configuring the gpg-agent
  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*[fn:2] application.
  15. #+begin_src conf
  16. allow-emacs-pinentry
  17. allow-loopback-pinentry
  18. #+end_src
  19. ** Restarting the gpg-agent
  20. You may need to restart the *gpg-agent*[fn:1] to load the configuration without rebooting.
  21. #+begin_src shell
  22. gpgconf --reload gpg-agent
  23. #+end_src
  24. ** Creating a symbolic link
  25. Create the symbolic link to the configuration file
  26. #+begin_src emacs-lisp
  27. (dotfiles/symlink "~/.emacs.d/config/gpg-agent.conf"
  28. "~/.gnupg/gpg-agent.conf")
  29. #+end_src
  30. * Setting up pinentry in Emacs
  31. With the *Pinentry*[fn:2] package for Emacs prompts will now appear in the minibuffer.
  32. #+begin_src emacs-lisp
  33. (use-package pinentry
  34. :custom (epa-file-select-keys 2)
  35. (epa-pinentry-mode 'loopback)
  36. (epa-file-encrypt-to dotfiles/public-key)
  37. (epa-file-cache-passphrase-for-symmetric-encryption t)
  38. :config (pinentry-start))
  39. #+end_src
  40. ** Including *.gpg files
  41. Override ~org-agenda-file-regexp~ to include =.org.gpg= files.
  42. #+begin_src emacs-lisp
  43. (unless (string-match-p "\\.gpg" org-agenda-file-regexp)
  44. (setq org-agenda-file-regexp
  45. (replace-regexp-in-string "\\\\\\.org" "\\\\.org\\\\(\\\\.gpg\\\\)?"
  46. org-agenda-file-regexp)))
  47. #+end_src
  48. ** Encrypting roam files
  49. Irrelevant without the [[file:writing.org][Writing]] module, encrypt new files from capture templates.
  50. #+begin_src emacs-lisp
  51. (with-eval-after-load 'org-roam
  52. (setq org-roam-encrypt-files t))
  53. #+end_src
  54. * Managing passwords
  55. *Pass*[fn:3] makes managing passwords easy, encrypring them in a file structure and providing easy commands for generating, modify, and copying passwords. *Password-store.el*[fn:4] provides a wrapper for the functionality within Emacs.
  56. #+begin_src emacs-lisp
  57. (use-package password-store
  58. :custom (password-store-dir dotfiles/passwords))
  59. #+end_src
  60. Configure keybindings behind =SPC p=.
  61. + Copy with =p=
  62. + Rename with =r=
  63. + Generate with =g=
  64. #+begin_src emacs-lisp
  65. (dotfiles/leader
  66. "p" '(:ignore t :which-key "Passwords")
  67. "pp" '(password-store-copy :which-key "Copy")
  68. "pr" '(password-store-rename :which-key "Rename")
  69. "pg" '(password-store-generate :which-key "Generate"))
  70. #+end_src
  71. * Resources
  72. [fn:1] https://gnupg.org
  73. [fn:2] https://elpa.gnu.org/packages/pinentry.html
  74. [fn:3] https://passwordstore.org
  75. [fn:4] https://git.zx2c4.com/password-store/tree/contrib/emacs