UP | HOME

GPG with emacs integration

Table of Contents

I use emacs. I trust in GPG.

My security requirements are:

1 Quickstart

  • Install GPG2 - on mac, I use GPG tools1
  • Create GPG key
  • Back up your GPG key (including private)
  • GPG tools has a feature that allows backing up public key with secret
  • Make sure to select the include secret checkbox

1.1 Encrypt/Decrypt files using GPG2 and Emacs

Point Emacs to GPG tools

;; Add to your ~/.emacs.d/init.el
(require 'epa-file)
(epa-file-enable)
;; Point emacs can find the gpg executable
(add-to-list 'exec-path "/usr/local/bin")
(setq epg-gpg-program "/usr/local/bin/gpg")
  • Be sure to Remove saving backup files
  • Save file with .gpg extension 2

Setup each file to be encrypted seamlessly 3

# -*- mode:org; epa-file-encrypt-to: ("me@emailaddress.com") -*-

Save the file 4

A pop up ask you for password.

Footnotes: