mw2txt.py: Update to version 0.2 (mostly Python 3 conversion)
[mw2txt.git] / posts / gpg-agent.mdwn
1 The 2.X branch of [[GnuPG]] comes with [gpg-agent][] for caching
2 passphrases.  The documentation is good, but here are my notes
3 outlining my usual usage.
4
5 Add the following to your `~/.bashrc` (see [[dotfiles]] for fancy
6 dotfiles maintenance):
7
8     if [ -f "${HOME}/.gnupg/agent-info" ]; then
9       source "${HOME}/.gnupg/agent-info"
10     fi
11
12 Start the agent with
13
14     $ gpg-agent --daemon --display "${DISPLAY}" --ttyname $(TTY) --keep-tty --keep-display --write-env-file "${HOME}/.gnupg/agent-info"
15     $ source "${HOME}/.gnupg/agent-info"
16
17 The `ttyname` bit will spawn the `pinentry` call in the designated
18 TTY.  This avoids troublesome issues like pinentry clobbering [[Mutt]]
19 if they are both using ncurses.
20
21 I didn't like any of the pinentry programs available on my system, so
22 I wrote my own in [[pyassuan]].
23
24 When you are done with the agent, kill it with
25
26     $ killall gpg-agent
27     $ rm -f "${HOME}/.gnupg/agent-info"
28
29 Since these commands are tedious to remember and type, I've wrapped
30 them in little scripts: [[gpg-agent-spawn.sh]] and
31 [[gpg-agent-kill.sh]].
32
33 [gpg-agent]: http://www.gnupg.org/documentation/manuals/gnupg/Invoking-GPG_002dAGENT.html
34
35 [[!tag tags/linux]]
36 [[!tag tags/tools]]